diff options
author | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-17 00:30:01 +0000 |
---|---|---|
committer | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-17 00:30:01 +0000 |
commit | 5f76da88e6734cda22d39adb0f5e4cca27f07690 (patch) | |
tree | 86ae8917fe709fdb2d1fb91b3616930bc6755f56 | |
parent | e89e638af5f9817cb0bb8eaa82ac7e0f70a9d02e (diff) | |
download | chromium_src-5f76da88e6734cda22d39adb0f5e4cca27f07690.zip chromium_src-5f76da88e6734cda22d39adb0f5e4cca27f07690.tar.gz chromium_src-5f76da88e6734cda22d39adb0f5e4cca27f07690.tar.bz2 |
Move response_data_file from ResourceResponseHead to webkit_glue::ResponseInfo
We would like to use the entry response_data_file in ResourceResponseHead
(currently in chrome/browser/resource_handler.h) in chrome/renderer. So refactor the
member and move it to webkit_glue::ResourceLoaderBridge::ResponsseInfo which
is the base class of ResourceResponseHead.
Review URL: http://codereview.chromium.org/42199
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11810 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/renderer_host/resource_handler.h | 19 | ||||
-rw-r--r-- | chrome/common/render_messages.h | 8 | ||||
-rw-r--r-- | webkit/glue/resource_loader_bridge.cc | 6 | ||||
-rw-r--r-- | webkit/glue/resource_loader_bridge.h | 19 |
4 files changed, 29 insertions, 23 deletions
diff --git a/chrome/browser/renderer_host/resource_handler.h b/chrome/browser/renderer_host/resource_handler.h index e0713d9..2b843f9 100644 --- a/chrome/browser/renderer_host/resource_handler.h +++ b/chrome/browser/renderer_host/resource_handler.h @@ -14,11 +14,6 @@ #include <string> -#include "build/build_config.h" -#if defined(OS_POSIX) -#include "base/file_descriptor_posix.h" -#endif -#include "base/platform_file.h" #include "chrome/common/filter_policy.h" #include "net/url_request/url_request_status.h" #include "webkit/glue/resource_loader_bridge.h" @@ -36,20 +31,6 @@ struct ResourceResponseHead // Specifies if the resource should be filtered before being displayed // (insecure resources can be filtered to keep the page secure). FilterPolicy::Type filter_policy; - - // A platform specific handle for a file that carries response data. This - // entry is used if the resource request is of type ResourceType::MEDIA and - // the underlying cache layer keeps the response data in a standalone file. -#if defined(OS_POSIX) - // If the response data file is available, the file handle is stored in - // response_data_file.fd, its value is base::kInvalidPlatformFileValue - // otherwise. - base::FileDescriptor response_data_file; -#elif defined(OS_WIN) - // An asynchronous file handle to the response data file, its value is - // base::kInvalidPlatformFileValue if the file is not available. - base::PlatformFile response_data_file; -#endif }; // Parameters for a synchronous resource response. diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index ded088f..8ee6b9a 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -1374,6 +1374,7 @@ struct ParamTraits<webkit_glue::ResourceLoaderBridge::ResponseInfo> { WriteParam(m, p.charset); WriteParam(m, p.security_info); WriteParam(m, p.content_length); + WriteParam(m, p.response_data_file); } static bool Read(const Message* m, void** iter, param_type* r) { return @@ -1383,7 +1384,8 @@ struct ParamTraits<webkit_glue::ResourceLoaderBridge::ResponseInfo> { ReadParam(m, iter, &r->mime_type) && ReadParam(m, iter, &r->charset) && ReadParam(m, iter, &r->security_info) && - ReadParam(m, iter, &r->content_length); + ReadParam(m, iter, &r->content_length) && + ReadParam(m, iter, &r->response_data_file); } static void Log(const param_type& p, std::wstring* l) { l->append(L"("); @@ -1409,7 +1411,6 @@ struct ParamTraits<ResourceResponseHead> { ParamTraits<webkit_glue::ResourceLoaderBridge::ResponseInfo>::Write(m, p); WriteParam(m, p.status); WriteParam(m, p.filter_policy); - WriteParam(m, p.response_data_file); } static bool Read(const Message* m, void** iter, param_type* r) { return @@ -1417,8 +1418,7 @@ struct ParamTraits<ResourceResponseHead> { iter, r) && ReadParam(m, iter, &r->status) && - ReadParam(m, iter, &r->filter_policy) && - ReadParam(m, iter, &r->response_data_file); + ReadParam(m, iter, &r->filter_policy); } static void Log(const param_type& p, std::wstring* l) { // log more? diff --git a/webkit/glue/resource_loader_bridge.cc b/webkit/glue/resource_loader_bridge.cc index 5b29fb0..266b518 100644 --- a/webkit/glue/resource_loader_bridge.cc +++ b/webkit/glue/resource_loader_bridge.cc @@ -12,6 +12,12 @@ namespace webkit_glue { ResourceLoaderBridge::ResponseInfo::ResponseInfo() { +#if defined(OS_WIN) + response_data_file = base::kInvalidPlatformFileValue; +#elif defined(OS_POSIX) + response_data_file.fd = base::kInvalidPlatformFileValue; + response_data_file.auto_close = false; +#endif } ResourceLoaderBridge::ResponseInfo::~ResponseInfo() { diff --git a/webkit/glue/resource_loader_bridge.h b/webkit/glue/resource_loader_bridge.h index 482ca84..2061a3b 100644 --- a/webkit/glue/resource_loader_bridge.h +++ b/webkit/glue/resource_loader_bridge.h @@ -17,6 +17,11 @@ #ifndef RESOURCE_LOADER_BRIDGE_H_ #define RESOURCE_LOADER_BRIDGE_H_ +#include "build/build_config.h"
+#if defined(OS_POSIX)
+#include "base/file_descriptor_posix.h"
+#endif
+#include "base/platform_file.h" #include "base/ref_counted.h" #include "base/time.h" #include "googleurl/src/gurl.h" @@ -61,6 +66,20 @@ class ResourceLoaderBridge { // Content length if available. -1 if not available int64 content_length; + + // A platform specific handle for a file that carries response data. This
+ // entry is used if the resource request is of type ResourceType::MEDIA and
+ // the underlying cache layer keeps the response data in a standalone file.
+#if defined(OS_POSIX)
+ // If the response data file is available, the file handle is stored in
+ // response_data_file.fd, its value is base::kInvalidPlatformFileValue
+ // otherwise.
+ base::FileDescriptor response_data_file;
+#elif defined(OS_WIN)
+ // An asynchronous file handle to the response data file, its value is
+ // base::kInvalidPlatformFileValue if the file is not available.
+ base::PlatformFile response_data_file;
+#endif }; // See the SyncLoad method declared below. (The name of this struct is not |