From 032dea757076b465d613314736095ce82c542c1b Mon Sep 17 00:00:00 2001 From: "michaeln@chromium.org" Date: Mon, 26 Apr 2010 23:52:47 +0000 Subject: Ground work for making appcaches work in workers. Add ResourceRequest target types for worker and shared worker resources. This is the first patch of a two-sided change that involves WebKit API changes which haven't been made yet. BUG=39368 TEST=none Review URL: http://codereview.chromium.org/1666002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45643 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/glue/resource_type.h | 9 ++++++++- webkit/glue/weburlloader_impl.cc | 8 +++++++- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'webkit') diff --git a/webkit/glue/resource_type.h b/webkit/glue/resource_type.h index 14f228b..140282a 100644 --- a/webkit/glue/resource_type.h +++ b/webkit/glue/resource_type.h @@ -20,6 +20,8 @@ class ResourceType { OBJECT, // an object (or embed) tag for a plugin, // or a resource that a plugin requested. MEDIA, // a media resource. + SHARED_WORKER, // the main resource of a shared worker. + WORKER, // the main resource of a dedicated worker. LAST_TYPE // Place holder so we don't need to change ValidType // everytime. }; @@ -36,12 +38,17 @@ class ResourceType { return type == MAIN_FRAME || type == SUB_FRAME; } + static bool IsSharedWorker(ResourceType::Type type) { + return type == SHARED_WORKER; + } + static bool IsSubresource(ResourceType::Type type) { return type == STYLESHEET || type == SCRIPT || type == IMAGE || type == FONT_RESOURCE || - type == SUB_RESOURCE; + type == SUB_RESOURCE || + type == WORKER; } private: diff --git a/webkit/glue/weburlloader_impl.cc b/webkit/glue/weburlloader_impl.cc index d1d17a4..710a84b 100644 --- a/webkit/glue/weburlloader_impl.cc +++ b/webkit/glue/weburlloader_impl.cc @@ -124,8 +124,14 @@ ResourceType::Type FromTargetType(WebURLRequest::TargetType type) { return ResourceType::OBJECT; case WebURLRequest::TargetIsMedia: return ResourceType::MEDIA; + // TODO(michaeln): uncomment the following cases and the NOTREACHED() call + // when the webkit API has been committed and these constants are defined. + // case WebURLRequest::TargetIsWorker: + // return ResourceType::WORKER; + // case WebURLRequest::TargetIsSharedWorker: + // return ResourceType::SHARED_WORKER; default: - NOTREACHED(); + // NOTREACHED(); return ResourceType::SUB_RESOURCE; } } -- cgit v1.1