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, ...@@ -94,7 +94,7 @@ FontResource::FontResource(const ResourceRequest& resource_request,
FontResource::~FontResource() = default; FontResource::~FontResource() = default;
void FontResource::DidAddClient(ResourceClient* c) { void FontResource::DidAddClient(ResourceClient* c) {
DCHECK(FontResourceClient::IsExpectedType(c)); DCHECK(c->IsFontResourceClient());
Resource::DidAddClient(c); Resource::DidAddClient(c);
// Block client callbacks if currently loading from cache. // Block client callbacks if currently loading from cache.
......
...@@ -113,10 +113,8 @@ DEFINE_RESOURCE_TYPE_CASTS(Font); ...@@ -113,10 +113,8 @@ DEFINE_RESOURCE_TYPE_CASTS(Font);
class FontResourceClient : public ResourceClient { class FontResourceClient : public ResourceClient {
public: public:
~FontResourceClient() override = default; ~FontResourceClient() override = default;
static bool IsExpectedType(ResourceClient* client) {
return client->GetResourceClientType() == kFontType; bool IsFontResourceClient() const final { return true; }
}
ResourceClientType GetResourceClientType() const final { return kFontType; }
// If cache-aware loading is activated, both callbacks will be blocked until // If cache-aware loading is activated, both callbacks will be blocked until
// disk cache miss. Calls to addClient() and removeClient() in both callbacks // disk cache miss. Calls to addClient() and removeClient() in both callbacks
......
...@@ -151,7 +151,7 @@ void RawResource::DidAddClient(ResourceClient* c) { ...@@ -151,7 +151,7 @@ void RawResource::DidAddClient(ResourceClient* c) {
CHECK(!IsCacheValidator()); CHECK(!IsCacheValidator());
if (!HasClient(c)) if (!HasClient(c))
return; return;
DCHECK(RawResourceClient::IsExpectedType(c)); DCHECK(c->IsRawResourceClient());
RevalidationStartForbiddenScope revalidation_start_forbidden_scope(this); RevalidationStartForbiddenScope revalidation_start_forbidden_scope(this);
RawResourceClient* client = static_cast<RawResourceClient*>(c); RawResourceClient* client = static_cast<RawResourceClient*>(c);
for (const auto& redirect : RedirectChain()) { for (const auto& redirect : RedirectChain()) {
......
...@@ -164,12 +164,7 @@ inline RawResource* ToRawResource(Resource* resource) { ...@@ -164,12 +164,7 @@ inline RawResource* ToRawResource(Resource* resource) {
class PLATFORM_EXPORT RawResourceClient : public ResourceClient { class PLATFORM_EXPORT RawResourceClient : public ResourceClient {
public: public:
static bool IsExpectedType(ResourceClient* client) { bool IsRawResourceClient() const final { return true; }
return client->GetResourceClientType() == kRawResourceType;
}
ResourceClientType GetResourceClientType() const final {
return kRawResourceType;
}
// The order of the callbacks is as follows: // The order of the callbacks is as follows:
// [Case 1] A successful load: // [Case 1] A successful load:
......
...@@ -41,13 +41,7 @@ class Resource; ...@@ -41,13 +41,7 @@ class Resource;
class PLATFORM_EXPORT ResourceClient : public GarbageCollectedMixin { class PLATFORM_EXPORT ResourceClient : public GarbageCollectedMixin {
USING_PRE_FINALIZER(ResourceClient, ClearResource); USING_PRE_FINALIZER(ResourceClient, ClearResource);
public: public:
enum ResourceClientType {
kBaseResourceType,
kFontType,
kRawResourceType
};
virtual ~ResourceClient() = default; virtual ~ResourceClient() = default;
...@@ -64,10 +58,9 @@ class PLATFORM_EXPORT ResourceClient : public GarbageCollectedMixin { ...@@ -64,10 +58,9 @@ class PLATFORM_EXPORT ResourceClient : public GarbageCollectedMixin {
size_t /* length */) {} size_t /* length */) {}
virtual void NotifyFinished(Resource*) {} virtual void NotifyFinished(Resource*) {}
static bool IsExpectedType(ResourceClient*) { return true; } virtual bool IsFontResourceClient() const { return false; }
virtual ResourceClientType GetResourceClientType() const {
return kBaseResourceType; virtual bool IsRawResourceClient() const { return false; }
}
Resource* GetResource() const { return resource_; } Resource* GetResource() const { return resource_; }
......
...@@ -51,7 +51,6 @@ class ResourceClientWalker { ...@@ -51,7 +51,6 @@ class ResourceClientWalker {
ResourceClient* next = client_vector_[index_++]; ResourceClient* next = client_vector_[index_++];
DCHECK(next); DCHECK(next);
if (client_set_.Contains(next)) { if (client_set_.Contains(next)) {
DCHECK(T::IsExpectedType(next));
return static_cast<T*>(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