Commit 88ff34cd authored by Katie Dillon's avatar Katie Dillon Committed by Commit Bot

Removing ResourceClientType enum

Bug: 878975
Change-Id: If951e1f175c4103006845bda9bb740f2b2a6afc6
Reviewed-on: https://chromium-review.googlesource.com/1212090
Commit-Queue: Katie Dillon <kdillon@chromium.org>
Reviewed-by: default avatarNate Chapin <japhet@chromium.org>
Cr-Commit-Position: refs/heads/master@{#589699}
parent d002ecc0
......@@ -94,7 +94,7 @@ FontResource::FontResource(const ResourceRequest& resource_request,
FontResource::~FontResource() = default;
void FontResource::DidAddClient(ResourceClient* c) {
DCHECK(FontResourceClient::IsExpectedType(c));
DCHECK(c->IsFontResourceClient());
Resource::DidAddClient(c);
// Block client callbacks if currently loading from cache.
......
......@@ -113,10 +113,8 @@ DEFINE_RESOURCE_TYPE_CASTS(Font);
class FontResourceClient : public ResourceClient {
public:
~FontResourceClient() override = default;
static bool IsExpectedType(ResourceClient* client) {
return client->GetResourceClientType() == kFontType;
}
ResourceClientType GetResourceClientType() const final { return kFontType; }
bool IsFontResourceClient() const final { return true; }
// If cache-aware loading is activated, both callbacks will be blocked until
// disk cache miss. Calls to addClient() and removeClient() in both callbacks
......
......@@ -151,7 +151,7 @@ void RawResource::DidAddClient(ResourceClient* c) {
CHECK(!IsCacheValidator());
if (!HasClient(c))
return;
DCHECK(RawResourceClient::IsExpectedType(c));
DCHECK(c->IsRawResourceClient());
RevalidationStartForbiddenScope revalidation_start_forbidden_scope(this);
RawResourceClient* client = static_cast<RawResourceClient*>(c);
for (const auto& redirect : RedirectChain()) {
......
......@@ -164,12 +164,7 @@ inline RawResource* ToRawResource(Resource* resource) {
class PLATFORM_EXPORT RawResourceClient : public ResourceClient {
public:
static bool IsExpectedType(ResourceClient* client) {
return client->GetResourceClientType() == kRawResourceType;
}
ResourceClientType GetResourceClientType() const final {
return kRawResourceType;
}
bool IsRawResourceClient() const final { return true; }
// The order of the callbacks is as follows:
// [Case 1] A successful load:
......
......@@ -41,13 +41,7 @@ class Resource;
class PLATFORM_EXPORT ResourceClient : public GarbageCollectedMixin {
USING_PRE_FINALIZER(ResourceClient, ClearResource);
public:
enum ResourceClientType {
kBaseResourceType,
kFontType,
kRawResourceType
};
virtual ~ResourceClient() = default;
......@@ -64,10 +58,9 @@ class PLATFORM_EXPORT ResourceClient : public GarbageCollectedMixin {
size_t /* length */) {}
virtual void NotifyFinished(Resource*) {}
static bool IsExpectedType(ResourceClient*) { return true; }
virtual ResourceClientType GetResourceClientType() const {
return kBaseResourceType;
}
virtual bool IsFontResourceClient() const { return false; }
virtual bool IsRawResourceClient() const { return false; }
Resource* GetResource() const { return resource_; }
......
......@@ -51,7 +51,6 @@ class ResourceClientWalker {
ResourceClient* next = client_vector_[index_++];
DCHECK(next);
if (client_set_.Contains(next)) {
DCHECK(T::IsExpectedType(next));
return static_cast<T*>(next);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment