diff options
29 files changed, 531 insertions, 467 deletions
diff --git a/chrome/browser/debugger/devtools_netlog_observer.h b/chrome/browser/debugger/devtools_netlog_observer.h index 501ff5d..78317ad 100644 --- a/chrome/browser/debugger/devtools_netlog_observer.h +++ b/chrome/browser/debugger/devtools_netlog_observer.h @@ -19,7 +19,7 @@ struct ResourceResponse; // stuff that may be of interest to DevTools. Currently, this only includes // actual HTTP/SPDY headers sent and received over the network. class DevToolsNetLogObserver: public ChromeNetLog::Observer { - typedef webkit_glue::ResourceLoaderBridge::DevToolsInfo ResourceInfo; + typedef webkit_glue::ResourceDevToolsInfo ResourceInfo; public: // Observer implementation: diff --git a/chrome/browser/net/load_timing_observer.cc b/chrome/browser/net/load_timing_observer.cc index 433aa9b..d93ccf8 100644 --- a/chrome/browser/net/load_timing_observer.cc +++ b/chrome/browser/net/load_timing_observer.cc @@ -15,6 +15,7 @@ using base::Time; using base::TimeTicks; using webkit_glue::ResourceLoaderBridge; +using webkit_glue::ResourceLoadTimingInfo; const size_t kMaxNumEntries = 1000; @@ -143,7 +144,7 @@ void LoadTimingObserver::OnAddURLRequestEntry( if (!record) return; - ResourceLoaderBridge::LoadTimingInfo& timing = record->timing; + ResourceLoadTimingInfo& timing = record->timing; switch (type) { case net::NetLog::TYPE_PROXY_SERVICE: diff --git a/chrome/browser/net/load_timing_observer.h b/chrome/browser/net/load_timing_observer.h index a46d6a6..fad011b 100644 --- a/chrome/browser/net/load_timing_observer.h +++ b/chrome/browser/net/load_timing_observer.h @@ -23,7 +23,7 @@ class LoadTimingObserver : public ChromeNetLog::Observer { struct URLRequestRecord { URLRequestRecord(); - webkit_glue::ResourceLoaderBridge::LoadTimingInfo timing; + webkit_glue::ResourceLoadTimingInfo timing; uint32 connect_job_id; uint32 socket_log_id; bool socket_reused; diff --git a/chrome/browser/renderer_host/async_resource_handler.cc b/chrome/browser/renderer_host/async_resource_handler.cc index 982d5a7..92202fa 100644 --- a/chrome/browser/renderer_host/async_resource_handler.cc +++ b/chrome/browser/renderer_host/async_resource_handler.cc @@ -15,6 +15,7 @@ #include "chrome/browser/renderer_host/global_request_id.h" #include "chrome/browser/renderer_host/resource_dispatcher_host_request_info.h" #include "chrome/common/render_messages.h" +#include "chrome/common/resource_response.h" #include "net/base/io_buffer.h" #include "net/base/load_flags.h" #include "net/base/net_log.h" diff --git a/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc b/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc index d3748c1..0051614 100644 --- a/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc +++ b/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc @@ -15,6 +15,7 @@ #include "chrome/common/chrome_plugin_lib.h" #include "chrome/common/render_messages.h" #include "chrome/common/render_messages_params.h" +#include "chrome/common/resource_response.h" #include "net/base/net_errors.h" #include "net/base/upload_data.h" #include "net/http/http_util.h" diff --git a/chrome/common/common_param_traits.h b/chrome/common/common_param_traits.h index a2c5dca..11c9749 100644 --- a/chrome/common/common_param_traits.h +++ b/chrome/common/common_param_traits.h @@ -12,8 +12,6 @@ #define CHROME_COMMON_COMMON_PARAM_TRAITS_H_ #pragma once -#include <vector> - #include "app/surface/transport_dib.h" #include "base/file_util.h" #include "base/ref_counted.h" diff --git a/chrome/common/extensions/extension_localization_peer.cc b/chrome/common/extensions/extension_localization_peer.cc index 315b9f0..06e0317 100644 --- a/chrome/common/extensions/extension_localization_peer.cc +++ b/chrome/common/extensions/extension_localization_peer.cc @@ -48,7 +48,7 @@ void ExtensionLocalizationPeer::OnUploadProgress( bool ExtensionLocalizationPeer::OnReceivedRedirect( const GURL& new_url, - const webkit_glue::ResourceLoaderBridge::ResponseInfo& info, + const webkit_glue::ResourceResponseInfo& info, bool* has_new_first_party_for_cookies, GURL* new_first_party_for_cookies) { NOTREACHED(); @@ -56,7 +56,7 @@ bool ExtensionLocalizationPeer::OnReceivedRedirect( } void ExtensionLocalizationPeer::OnReceivedResponse( - const webkit_glue::ResourceLoaderBridge::ResponseInfo& info, + const webkit_glue::ResourceResponseInfo& info, bool content_filtered) { response_info_ = info; } diff --git a/chrome/common/extensions/extension_localization_peer.h b/chrome/common/extensions/extension_localization_peer.h index 4beee2d..b2b7c7a 100644 --- a/chrome/common/extensions/extension_localization_peer.h +++ b/chrome/common/extensions/extension_localization_peer.h @@ -34,11 +34,11 @@ class ExtensionLocalizationPeer virtual void OnUploadProgress(uint64 position, uint64 size); virtual bool OnReceivedRedirect( const GURL& new_url, - const webkit_glue::ResourceLoaderBridge::ResponseInfo& info, + const webkit_glue::ResourceResponseInfo& info, bool* has_new_first_party_for_cookies, GURL* new_first_party_for_cookies); virtual void OnReceivedResponse( - const webkit_glue::ResourceLoaderBridge::ResponseInfo& info, + const webkit_glue::ResourceResponseInfo& info, bool content_filtered); virtual void OnDownloadedData(int len) {} virtual void OnReceivedData(const char* data, int len); @@ -64,7 +64,7 @@ class ExtensionLocalizationPeer webkit_glue::ResourceLoaderBridge::Peer* original_peer_; // We just pass though the response info. This holds the copy of the original. - webkit_glue::ResourceLoaderBridge::ResponseInfo response_info_; + webkit_glue::ResourceResponseInfo response_info_; // Sends ViewHostMsg_GetExtensionMessageBundle message to the browser to fetch // message catalog. diff --git a/chrome/common/extensions/extension_localization_peer_unittest.cc b/chrome/common/extensions/extension_localization_peer_unittest.cc index dbcce27..bc6f73f 100644 --- a/chrome/common/extensions/extension_localization_peer_unittest.cc +++ b/chrome/common/extensions/extension_localization_peer_unittest.cc @@ -60,11 +60,11 @@ class MockResourceLoaderBridgePeer MOCK_METHOD2(OnUploadProgress, void(uint64 position, uint64 size)); MOCK_METHOD4(OnReceivedRedirect, bool( const GURL& new_url, - const webkit_glue::ResourceLoaderBridge::ResponseInfo& info, + const webkit_glue::ResourceResponseInfo& info, bool* has_new_first_party_for_cookies, GURL* new_first_party_for_cookies)); MOCK_METHOD2(OnReceivedResponse, void( - const webkit_glue::ResourceLoaderBridge::ResponseInfo& info, + const webkit_glue::ResourceResponseInfo& info, bool content_filtered)); MOCK_METHOD1(OnDownloadedData, void(int len)); MOCK_METHOD2(OnReceivedData, void(const char* data, int len)); diff --git a/chrome/common/render_messages.cc b/chrome/common/render_messages.cc index ff80db6..5d422da 100644 --- a/chrome/common/render_messages.cc +++ b/chrome/common/render_messages.cc @@ -12,31 +12,34 @@ #include "chrome/common/indexed_db_key.h" #include "chrome/common/indexed_db_param_traits.h" #include "chrome/common/render_messages_params.h" +#include "chrome/common/resource_response.h" #include "chrome/common/serialized_script_value.h" #include "chrome/common/thumbnail_score.h" #include "gfx/rect.h" #include "ipc/ipc_channel_handle.h" +#include "media/audio/audio_buffers_state.h" #include "net/base/upload_data.h" #include "net/http/http_response_headers.h" -#include "third_party/skia/include/core/SkBitmap.h" #include "third_party/WebKit/WebKit/chromium/public/WebCompositionUnderline.h" #include "third_party/WebKit/WebKit/chromium/public/WebFindOptions.h" #include "third_party/WebKit/WebKit/chromium/public/WebMediaPlayerAction.h" #include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h" +#include "third_party/skia/include/core/SkBitmap.h" #include "webkit/appcache/appcache_interfaces.h" #include "webkit/blob/blob_data.h" #include "webkit/glue/context_menu.h" +#include "webkit/glue/dom_operations.h" #include "webkit/glue/form_data.h" #include "webkit/glue/form_field.h" -#include "webkit/glue/password_form_dom_manager.h" #include "webkit/glue/password_form.h" +#include "webkit/glue/password_form_dom_manager.h" +#include "webkit/glue/plugins/webplugin.h" +#include "webkit/glue/plugins/webplugininfo.h" +#include "webkit/glue/resource_loader_bridge.h" #include "webkit/glue/webaccessibility.h" #include "webkit/glue/webcookie.h" #include "webkit/glue/webcursor.h" #include "webkit/glue/webdropdata.h" -#include "webkit/glue/plugins/webplugin.h" -#include "webkit/glue/plugins/webplugininfo.h" -#include "webkit/glue/dom_operations.h" #include "webkit/glue/webmenuitem.h" #if defined(OS_MACOSX) @@ -345,6 +348,240 @@ void ParamTraits<scoped_refptr<net::HttpResponseHeaders> >::Log( l->append("<HttpResponseHeaders>"); } +void ParamTraits<webkit_glue::ResourceLoadTimingInfo>::Write( + Message* m, const param_type& p) { + WriteParam(m, p.base_time.is_null()); + if (p.base_time.is_null()) + return; + WriteParam(m, p.base_time); + WriteParam(m, p.proxy_start); + WriteParam(m, p.proxy_end); + WriteParam(m, p.dns_start); + WriteParam(m, p.dns_end); + WriteParam(m, p.connect_start); + WriteParam(m, p.connect_end); + WriteParam(m, p.ssl_start); + WriteParam(m, p.ssl_end); + WriteParam(m, p.send_start); + WriteParam(m, p.send_end); + WriteParam(m, p.receive_headers_start); + WriteParam(m, p.receive_headers_end); +} + +bool ParamTraits<webkit_glue::ResourceLoadTimingInfo>::Read( + const Message* m, void** iter, param_type* r) { + bool is_null; + if (!ReadParam(m, iter, &is_null)) + return false; + if (is_null) + return true; + + return + ReadParam(m, iter, &r->base_time) && + ReadParam(m, iter, &r->proxy_start) && + ReadParam(m, iter, &r->proxy_end) && + ReadParam(m, iter, &r->dns_start) && + ReadParam(m, iter, &r->dns_end) && + ReadParam(m, iter, &r->connect_start) && + ReadParam(m, iter, &r->connect_end) && + ReadParam(m, iter, &r->ssl_start) && + ReadParam(m, iter, &r->ssl_end) && + ReadParam(m, iter, &r->send_start) && + ReadParam(m, iter, &r->send_end) && + ReadParam(m, iter, &r->receive_headers_start) && + ReadParam(m, iter, &r->receive_headers_end); +} + +void ParamTraits<webkit_glue::ResourceLoadTimingInfo>::Log(const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.base_time, l); + l->append(", "); + LogParam(p.proxy_start, l); + l->append(", "); + LogParam(p.proxy_end, l); + l->append(", "); + LogParam(p.dns_start, l); + l->append(", "); + LogParam(p.dns_end, l); + l->append(", "); + LogParam(p.connect_start, l); + l->append(", "); + LogParam(p.connect_end, l); + l->append(", "); + LogParam(p.ssl_start, l); + l->append(", "); + LogParam(p.ssl_end, l); + l->append(", "); + LogParam(p.send_start, l); + l->append(", "); + LogParam(p.send_end, l); + l->append(", "); + LogParam(p.receive_headers_start, l); + l->append(", "); + LogParam(p.receive_headers_end, l); + l->append(")"); +} + +void ParamTraits<scoped_refptr<webkit_glue::ResourceDevToolsInfo> >::Write( + Message* m, const param_type& p) { + WriteParam(m, p.get() != NULL); + if (p.get()) { + WriteParam(m, p->request_headers); + WriteParam(m, p->response_headers); + } +} + +bool ParamTraits<scoped_refptr<webkit_glue::ResourceDevToolsInfo> >::Read( + const Message* m, void** iter, param_type* r) { + bool has_object; + if (!ReadParam(m, iter, &has_object)) + return false; + if (!has_object) + return true; + *r = new webkit_glue::ResourceDevToolsInfo(); + return + ReadParam(m, iter, &(*r)->request_headers) && + ReadParam(m, iter, &(*r)->response_headers); +} + +void ParamTraits<scoped_refptr<webkit_glue::ResourceDevToolsInfo> >::Log( + const param_type& p, std::string* l) { + l->append("("); + if (p) { + LogParam(p->request_headers, l); + l->append(", "); + LogParam(p->response_headers, l); + } + l->append(")"); +} + +void ParamTraits<webkit_glue::ResourceResponseInfo>::Write( + Message* m, const param_type& p) { + WriteParam(m, p.request_time); + WriteParam(m, p.response_time); + WriteParam(m, p.headers); + WriteParam(m, p.mime_type); + WriteParam(m, p.charset); + WriteParam(m, p.security_info); + WriteParam(m, p.content_length); + WriteParam(m, p.appcache_id); + WriteParam(m, p.appcache_manifest_url); + WriteParam(m, p.connection_id); + WriteParam(m, p.connection_reused); + WriteParam(m, p.load_timing); + WriteParam(m, p.devtools_info); + WriteParam(m, p.download_file_path); + WriteParam(m, p.was_fetched_via_spdy); + WriteParam(m, p.was_npn_negotiated); + WriteParam(m, p.was_alternate_protocol_available); + WriteParam(m, p.was_fetched_via_proxy); +} + +bool ParamTraits<webkit_glue::ResourceResponseInfo>::Read( + const Message* m, void** iter, param_type* r) { + return + ReadParam(m, iter, &r->request_time) && + ReadParam(m, iter, &r->response_time) && + ReadParam(m, iter, &r->headers) && + 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->appcache_id) && + ReadParam(m, iter, &r->appcache_manifest_url) && + ReadParam(m, iter, &r->connection_id) && + ReadParam(m, iter, &r->connection_reused) && + ReadParam(m, iter, &r->load_timing) && + ReadParam(m, iter, &r->devtools_info) && + ReadParam(m, iter, &r->download_file_path) && + ReadParam(m, iter, &r->was_fetched_via_spdy) && + ReadParam(m, iter, &r->was_npn_negotiated) && + ReadParam(m, iter, &r->was_alternate_protocol_available) && + ReadParam(m, iter, &r->was_fetched_via_proxy); +} + +void ParamTraits<webkit_glue::ResourceResponseInfo>::Log( + const param_type& p, std::string* l) { + l->append("("); + LogParam(p.request_time, l); + l->append(", "); + LogParam(p.response_time, l); + l->append(", "); + LogParam(p.headers, l); + l->append(", "); + LogParam(p.mime_type, l); + l->append(", "); + LogParam(p.charset, l); + l->append(", "); + LogParam(p.security_info, l); + l->append(", "); + LogParam(p.content_length, l); + l->append(", "); + LogParam(p.appcache_id, l); + l->append(", "); + LogParam(p.appcache_manifest_url, l); + l->append(", "); + LogParam(p.connection_id, l); + l->append(", "); + LogParam(p.connection_reused, l); + l->append(", "); + LogParam(p.load_timing, l); + l->append(", "); + LogParam(p.devtools_info, l); + l->append(", "); + LogParam(p.download_file_path, l); + l->append(", "); + LogParam(p.was_fetched_via_spdy, l); + l->append(", "); + LogParam(p.was_npn_negotiated, l); + l->append(", "); + LogParam(p.was_alternate_protocol_available, l); + l->append(", "); + LogParam(p.was_fetched_via_proxy, l); + l->append(")"); +} + +void ParamTraits<ResourceResponseHead>::Write(Message* m, const param_type& p) { + ParamTraits<webkit_glue::ResourceResponseInfo>::Write(m, p); + WriteParam(m, p.status); + WriteParam(m, p.replace_extension_localization_templates); +} + +bool ParamTraits<ResourceResponseHead>::Read(const Message* m, + void** iter, + param_type* r) { + return ParamTraits<webkit_glue::ResourceResponseInfo>::Read( + m, iter, r) && + ReadParam(m, iter, &r->status) && + ReadParam(m, iter, &r->replace_extension_localization_templates); +} + +void ParamTraits<ResourceResponseHead>::Log(const param_type& p, + std::string* l) { + // log more? + ParamTraits<webkit_glue::ResourceResponseInfo>::Log(p, l); +} + +void ParamTraits<SyncLoadResult>::Write(Message* m, const param_type& p) { + ParamTraits<ResourceResponseHead>::Write(m, p); + WriteParam(m, p.final_url); + WriteParam(m, p.data); + } + +bool ParamTraits<SyncLoadResult>::Read(const Message* m, void** iter, + param_type* r) { + return + ParamTraits<ResourceResponseHead>::Read(m, iter, r) && + ReadParam(m, iter, &r->final_url) && + ReadParam(m, iter, &r->data); + } + +void ParamTraits<SyncLoadResult>::Log(const param_type& p, std::string* l) { + // log more? + ParamTraits<webkit_glue::ResourceResponseInfo>::Log(p, l); + } + void ParamTraits<webkit_glue::FormData>::Write(Message* m, const param_type& p) { WriteParam(m, p.name); diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index 8408893..ea5d47c 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -20,18 +20,15 @@ #include "chrome/common/dom_storage_common.h" #include "chrome/common/indexed_db_param_traits.h" #include "chrome/common/page_transition_types.h" -#include "chrome/common/resource_response.h" #include "chrome/common/translate_errors.h" #include "chrome/common/view_types.h" #include "chrome/common/webkit_param_traits.h" #include "gfx/native_widget_types.h" #include "ipc/ipc_message_utils.h" #include "ipc/ipc_platform_file.h" // ifdefed typedef. -#include "media/audio/audio_buffers_state.h" #include "third_party/WebKit/WebKit/chromium/public/WebStorageArea.h" #include "webkit/appcache/appcache_interfaces.h" // enum appcache::Status #include "webkit/fileapi/file_system_types.h" // enum fileapi::FileSystemType -#include "webkit/glue/resource_loader_bridge.h" // nested classes #if defined(OS_MACOSX) struct FontDescriptor; @@ -55,18 +52,24 @@ namespace webkit_glue { struct FormData; class FormField; struct PasswordFormFillData; +struct ResourceDevToolsInfo; +struct ResourceLoadTimingInfo; +struct ResourceResponseInfo; struct WebAccessibility; struct WebCookie; struct WebPluginGeometry; struct WebAccessibility; } +struct AudioBuffersState; class ExtensionExtent; class GURL; class SkBitmap; class URLPattern; struct ContextMenuParams; struct EditCommand; +struct ResourceResponseHead; +struct SyncLoadResult; struct RendererPreferences; struct WebDropData; struct WebMenuItem; @@ -191,239 +194,46 @@ struct ParamTraits<scoped_refptr<net::HttpResponseHeaders> > { static void Log(const param_type& p, std::string* l); }; -// Traits for webkit_glue::ResourceLoaderBridge::LoadTimingInfo +// Traits for webkit_glue::ResourceLoadTimingInfo template <> -struct ParamTraits<webkit_glue::ResourceLoaderBridge::LoadTimingInfo> { - typedef webkit_glue::ResourceLoaderBridge::LoadTimingInfo param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.base_time.is_null()); - if (p.base_time.is_null()) - return; - WriteParam(m, p.base_time); - WriteParam(m, p.proxy_start); - WriteParam(m, p.proxy_end); - WriteParam(m, p.dns_start); - WriteParam(m, p.dns_end); - WriteParam(m, p.connect_start); - WriteParam(m, p.connect_end); - WriteParam(m, p.ssl_start); - WriteParam(m, p.ssl_end); - WriteParam(m, p.send_start); - WriteParam(m, p.send_end); - WriteParam(m, p.receive_headers_start); - WriteParam(m, p.receive_headers_end); - } - static bool Read(const Message* m, void** iter, param_type* r) { - bool is_null; - if (!ReadParam(m, iter, &is_null)) - return false; - if (is_null) - return true; - - return - ReadParam(m, iter, &r->base_time) && - ReadParam(m, iter, &r->proxy_start) && - ReadParam(m, iter, &r->proxy_end) && - ReadParam(m, iter, &r->dns_start) && - ReadParam(m, iter, &r->dns_end) && - ReadParam(m, iter, &r->connect_start) && - ReadParam(m, iter, &r->connect_end) && - ReadParam(m, iter, &r->ssl_start) && - ReadParam(m, iter, &r->ssl_end) && - ReadParam(m, iter, &r->send_start) && - ReadParam(m, iter, &r->send_end) && - ReadParam(m, iter, &r->receive_headers_start) && - ReadParam(m, iter, &r->receive_headers_end); - } - static void Log(const param_type& p, std::string* l) { - l->append("("); - LogParam(p.base_time, l); - l->append(", "); - LogParam(p.proxy_start, l); - l->append(", "); - LogParam(p.proxy_end, l); - l->append(", "); - LogParam(p.dns_start, l); - l->append(", "); - LogParam(p.dns_end, l); - l->append(", "); - LogParam(p.connect_start, l); - l->append(", "); - LogParam(p.connect_end, l); - l->append(", "); - LogParam(p.ssl_start, l); - l->append(", "); - LogParam(p.ssl_end, l); - l->append(", "); - LogParam(p.send_start, l); - l->append(", "); - LogParam(p.send_end, l); - l->append(", "); - LogParam(p.receive_headers_start, l); - l->append(", "); - LogParam(p.receive_headers_end, l); - l->append(")"); - } +struct ParamTraits<webkit_glue::ResourceLoadTimingInfo> { + typedef webkit_glue::ResourceLoadTimingInfo param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::string* l); }; template <> -struct ParamTraits< - scoped_refptr<webkit_glue::ResourceLoaderBridge::DevToolsInfo> > { - typedef scoped_refptr<webkit_glue::ResourceLoaderBridge::DevToolsInfo> - param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.get() != NULL); - if (p.get()) { - WriteParam(m, p->request_headers); - WriteParam(m, p->response_headers); - } - } - static bool Read(const Message* m, void** iter, param_type* r) { - bool has_object; - if (!ReadParam(m, iter, &has_object)) - return false; - if (!has_object) - return true; - *r = new webkit_glue::ResourceLoaderBridge::DevToolsInfo(); - return - ReadParam(m, iter, &(*r)->request_headers) && - ReadParam(m, iter, &(*r)->response_headers); - } - static void Log(const param_type& p, std::string* l) { - l->append("("); - if (p) { - LogParam(p->request_headers, l); - l->append(", "); - LogParam(p->response_headers, l); - } - l->append(")"); - } +struct ParamTraits<scoped_refptr<webkit_glue::ResourceDevToolsInfo> > { + typedef scoped_refptr<webkit_glue::ResourceDevToolsInfo> param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::string* l); }; -// Traits for webkit_glue::ResourceLoaderBridge::ResponseInfo +// Traits for webkit_glue::ResourceResponseInfo template <> -struct ParamTraits<webkit_glue::ResourceLoaderBridge::ResponseInfo> { - typedef webkit_glue::ResourceLoaderBridge::ResponseInfo param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.request_time); - WriteParam(m, p.response_time); - WriteParam(m, p.headers); - WriteParam(m, p.mime_type); - WriteParam(m, p.charset); - WriteParam(m, p.security_info); - WriteParam(m, p.content_length); - WriteParam(m, p.appcache_id); - WriteParam(m, p.appcache_manifest_url); - WriteParam(m, p.connection_id); - WriteParam(m, p.connection_reused); - WriteParam(m, p.load_timing); - WriteParam(m, p.devtools_info); - WriteParam(m, p.download_file_path); - WriteParam(m, p.was_fetched_via_spdy); - WriteParam(m, p.was_npn_negotiated); - WriteParam(m, p.was_alternate_protocol_available); - WriteParam(m, p.was_fetched_via_proxy); - } - static bool Read(const Message* m, void** iter, param_type* r) { - return - ReadParam(m, iter, &r->request_time) && - ReadParam(m, iter, &r->response_time) && - ReadParam(m, iter, &r->headers) && - 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->appcache_id) && - ReadParam(m, iter, &r->appcache_manifest_url) && - ReadParam(m, iter, &r->connection_id) && - ReadParam(m, iter, &r->connection_reused) && - ReadParam(m, iter, &r->load_timing) && - ReadParam(m, iter, &r->devtools_info) && - ReadParam(m, iter, &r->download_file_path) && - ReadParam(m, iter, &r->was_fetched_via_spdy) && - ReadParam(m, iter, &r->was_npn_negotiated) && - ReadParam(m, iter, &r->was_alternate_protocol_available) && - ReadParam(m, iter, &r->was_fetched_via_proxy); - } - static void Log(const param_type& p, std::string* l) { - l->append("("); - LogParam(p.request_time, l); - l->append(", "); - LogParam(p.response_time, l); - l->append(", "); - LogParam(p.headers, l); - l->append(", "); - LogParam(p.mime_type, l); - l->append(", "); - LogParam(p.charset, l); - l->append(", "); - LogParam(p.security_info, l); - l->append(", "); - LogParam(p.content_length, l); - l->append(", "); - LogParam(p.appcache_id, l); - l->append(", "); - LogParam(p.appcache_manifest_url, l); - l->append(", "); - LogParam(p.connection_id, l); - l->append(", "); - LogParam(p.connection_reused, l); - l->append(", "); - LogParam(p.load_timing, l); - l->append(", "); - LogParam(p.devtools_info, l); - l->append(", "); - LogParam(p.download_file_path, l); - l->append(", "); - LogParam(p.was_fetched_via_spdy, l); - l->append(", "); - LogParam(p.was_npn_negotiated, l); - l->append(", "); - LogParam(p.was_alternate_protocol_available, l); - l->append(", "); - LogParam(p.was_fetched_via_proxy, l); - l->append(")"); - } +struct ParamTraits<webkit_glue::ResourceResponseInfo> { + typedef webkit_glue::ResourceResponseInfo param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::string* l); }; template <> struct ParamTraits<ResourceResponseHead> { typedef ResourceResponseHead param_type; - static void Write(Message* m, const param_type& p) { - ParamTraits<webkit_glue::ResourceLoaderBridge::ResponseInfo>::Write(m, p); - WriteParam(m, p.status); - WriteParam(m, p.replace_extension_localization_templates); - } - static bool Read(const Message* m, void** iter, param_type* r) { - return ParamTraits<webkit_glue::ResourceLoaderBridge::ResponseInfo>::Read( - m, iter, r) && - ReadParam(m, iter, &r->status) && - ReadParam(m, iter, &r->replace_extension_localization_templates); - } - static void Log(const param_type& p, std::string* l) { - // log more? - ParamTraits<webkit_glue::ResourceLoaderBridge::ResponseInfo>::Log(p, l); - } + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::string* l); }; template <> struct ParamTraits<SyncLoadResult> { typedef SyncLoadResult param_type; - static void Write(Message* m, const param_type& p) { - ParamTraits<ResourceResponseHead>::Write(m, p); - WriteParam(m, p.final_url); - WriteParam(m, p.data); - } - static bool Read(const Message* m, void** iter, param_type* r) { - return - ParamTraits<ResourceResponseHead>::Read(m, iter, r) && - ReadParam(m, iter, &r->final_url) && - ReadParam(m, iter, &r->data); - } - static void Log(const param_type& p, std::string* l) { - // log more? - ParamTraits<webkit_glue::ResourceLoaderBridge::ResponseInfo>::Log(p, l); - } + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::string* l); }; // Traits for FormData structure to pack/unpack. diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index 1008de2..ae93fe4 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -54,6 +54,10 @@ struct Entry; } } +namespace gfx { +class Rect; +} + namespace IPC { struct ChannelHandle; class Message; diff --git a/chrome/common/resource_dispatcher.cc b/chrome/common/resource_dispatcher.cc index 9f182a1..e56ae7b 100644 --- a/chrome/common/resource_dispatcher.cc +++ b/chrome/common/resource_dispatcher.cc @@ -15,6 +15,7 @@ #include "chrome/common/extensions/extension_localization_peer.h" #include "chrome/common/render_messages.h" #include "chrome/common/render_messages_params.h" +#include "chrome/common/resource_response.h" #include "chrome/common/security_filter_peer.h" #include "net/base/net_errors.h" #include "net/base/net_util.h" @@ -427,7 +428,7 @@ void ResourceDispatcher::OnReceivedRedirect( const IPC::Message& message, int request_id, const GURL& new_url, - const webkit_glue::ResourceLoaderBridge::ResponseInfo& info) { + const webkit_glue::ResourceResponseInfo& info) { PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); if (!request_info) return; diff --git a/chrome/common/resource_dispatcher.h b/chrome/common/resource_dispatcher.h index 77e08ac..475119f 100644 --- a/chrome/common/resource_dispatcher.h +++ b/chrome/common/resource_dispatcher.h @@ -98,7 +98,7 @@ class ResourceDispatcher { const IPC::Message& message, int request_id, const GURL& new_url, - const webkit_glue::ResourceLoaderBridge::ResponseInfo& info); + const webkit_glue::ResourceResponseInfo& info); void OnReceivedData( const IPC::Message& message, int request_id, diff --git a/chrome/common/resource_dispatcher_unittest.cc b/chrome/common/resource_dispatcher_unittest.cc index ff007f9..8e31ee9 100644 --- a/chrome/common/resource_dispatcher_unittest.cc +++ b/chrome/common/resource_dispatcher_unittest.cc @@ -12,12 +12,14 @@ #include "chrome/common/render_messages.h" #include "chrome/common/render_messages_params.h" #include "chrome/common/resource_dispatcher.h" +#include "chrome/common/resource_response.h" #include "net/base/upload_data.h" #include "net/http/http_response_headers.h" #include "testing/gtest/include/gtest/gtest.h" #include "webkit/appcache/appcache_interfaces.h" using webkit_glue::ResourceLoaderBridge; +using webkit_glue::ResourceResponseInfo; static const char test_page_url[] = "http://www.google.com/"; static const char test_page_headers[] = @@ -40,7 +42,7 @@ class TestRequestCallback : public ResourceLoaderBridge::Peer { virtual bool OnReceivedRedirect( const GURL& new_url, - const ResourceLoaderBridge::ResponseInfo& info, + const ResourceResponseInfo& info, bool* has_new_first_party_for_cookies, GURL* new_first_party_for_cookies) { *has_new_first_party_for_cookies = false; @@ -48,7 +50,7 @@ class TestRequestCallback : public ResourceLoaderBridge::Peer { } virtual void OnReceivedResponse( - const ResourceLoaderBridge::ResponseInfo& info, + const ResourceResponseInfo& info, bool content_filtered) { } @@ -264,7 +266,7 @@ class DeferredResourceLoadingTest : public ResourceDispatcherTest, virtual bool OnReceivedRedirect( const GURL& new_url, - const ResourceLoaderBridge::ResponseInfo& info, + const ResourceResponseInfo& info, bool* has_new_first_party_for_cookies, GURL* new_first_party_for_cookies) { *has_new_first_party_for_cookies = false; @@ -272,7 +274,7 @@ class DeferredResourceLoadingTest : public ResourceDispatcherTest, } virtual void OnReceivedResponse( - const ResourceLoaderBridge::ResponseInfo& info, + const ResourceResponseInfo& info, bool content_filtered) { EXPECT_EQ(defer_loading_, false); set_defer_loading(true); diff --git a/chrome/common/resource_response.h b/chrome/common/resource_response.h index 0700a8c..058a811 100644 --- a/chrome/common/resource_response.h +++ b/chrome/common/resource_response.h @@ -16,8 +16,7 @@ #include "webkit/glue/resource_loader_bridge.h" // Parameters for a resource response header. -struct ResourceResponseHead - : webkit_glue::ResourceLoaderBridge::ResponseInfo { +struct ResourceResponseHead : webkit_glue::ResourceResponseInfo { ResourceResponseHead(); ~ResourceResponseHead(); diff --git a/chrome/common/security_filter_peer.cc b/chrome/common/security_filter_peer.cc index b4fcbd3..9b0815b 100644 --- a/chrome/common/security_filter_peer.cc +++ b/chrome/common/security_filter_peer.cc @@ -67,7 +67,7 @@ void SecurityFilterPeer::OnUploadProgress(uint64 position, uint64 size) { bool SecurityFilterPeer::OnReceivedRedirect( const GURL& new_url, - const webkit_glue::ResourceLoaderBridge::ResponseInfo& info, + const webkit_glue::ResourceResponseInfo& info, bool* has_new_first_party_for_cookies, GURL* new_first_party_for_cookies) { NOTREACHED(); @@ -75,7 +75,7 @@ bool SecurityFilterPeer::OnReceivedRedirect( } void SecurityFilterPeer::OnReceivedResponse( - const webkit_glue::ResourceLoaderBridge::ResponseInfo& info, + const webkit_glue::ResourceResponseInfo& info, bool content_filtered) { NOTREACHED(); } @@ -96,8 +96,8 @@ GURL SecurityFilterPeer::GetURLForDebugging() const { // static void ProcessResponseInfo( - const webkit_glue::ResourceLoaderBridge::ResponseInfo& info_in, - webkit_glue::ResourceLoaderBridge::ResponseInfo* info_out, + const webkit_glue::ResourceResponseInfo& info_in, + webkit_glue::ResourceResponseInfo* info_out, const std::string& mime_type) { DCHECK(info_out); *info_out = info_in; @@ -138,7 +138,7 @@ BufferedPeer::~BufferedPeer() { } void BufferedPeer::OnReceivedResponse( - const webkit_glue::ResourceLoaderBridge::ResponseInfo& info, + const webkit_glue::ResourceResponseInfo& info, bool response_filtered) { ProcessResponseInfo(info, &response_info_, mime_type_); } @@ -186,7 +186,7 @@ ReplaceContentPeer::~ReplaceContentPeer() { } void ReplaceContentPeer::OnReceivedResponse( - const webkit_glue::ResourceLoaderBridge::ResponseInfo& info, + const webkit_glue::ResourceResponseInfo& info, bool content_filtered) { // Ignore this, we'll serve some alternate content in OnCompletedRequest. } @@ -199,7 +199,7 @@ void ReplaceContentPeer::OnCompletedRequest( const URLRequestStatus& status, const std::string& security_info, const base::Time& completion_time) { - webkit_glue::ResourceLoaderBridge::ResponseInfo info; + webkit_glue::ResourceResponseInfo info; ProcessResponseInfo(info, &info, mime_type_); info.security_info = security_info; info.content_length = static_cast<int>(data_.size()); diff --git a/chrome/common/security_filter_peer.h b/chrome/common/security_filter_peer.h index 593fbb0..8365ebd 100644 --- a/chrome/common/security_filter_peer.h +++ b/chrome/common/security_filter_peer.h @@ -33,11 +33,11 @@ class SecurityFilterPeer : public webkit_glue::ResourceLoaderBridge::Peer { virtual void OnUploadProgress(uint64 position, uint64 size); virtual bool OnReceivedRedirect( const GURL& new_url, - const webkit_glue::ResourceLoaderBridge::ResponseInfo& info, + const webkit_glue::ResourceResponseInfo& info, bool* has_new_first_party_for_cookies, GURL* new_first_party_for_cookies); virtual void OnReceivedResponse( - const webkit_glue::ResourceLoaderBridge::ResponseInfo& info, + const webkit_glue::ResourceResponseInfo& info, bool content_filtered); virtual void OnDownloadedData(int len) {} virtual void OnReceivedData(const char* data, int len); @@ -68,7 +68,7 @@ class BufferedPeer : public SecurityFilterPeer { // ResourceLoaderBridge::Peer Implementation. virtual void OnReceivedResponse( - const webkit_glue::ResourceLoaderBridge::ResponseInfo& info, + const webkit_glue::ResourceResponseInfo& info, bool content_filtered); virtual void OnReceivedData(const char* data, int len); virtual void OnCompletedRequest(const URLRequestStatus& status, @@ -82,7 +82,7 @@ class BufferedPeer : public SecurityFilterPeer { // original peer, if it returns false, an error is sent instead. virtual bool DataReady() = 0; - webkit_glue::ResourceLoaderBridge::ResponseInfo response_info_; + webkit_glue::ResourceResponseInfo response_info_; std::string data_; private: @@ -109,7 +109,7 @@ class ReplaceContentPeer : public SecurityFilterPeer { // ResourceLoaderBridge::Peer Implementation. virtual void OnReceivedResponse( - const webkit_glue::ResourceLoaderBridge::ResponseInfo& info, + const webkit_glue::ResourceResponseInfo& info, bool content_filtered); void OnReceivedData(const char* data, int len); void OnCompletedRequest(const URLRequestStatus& status, @@ -117,7 +117,7 @@ class ReplaceContentPeer : public SecurityFilterPeer { const base::Time& completion_time); private: - webkit_glue::ResourceLoaderBridge::ResponseInfo response_info_; + webkit_glue::ResourceResponseInfo response_info_; std::string mime_type_; std::string data_; diff --git a/chrome/plugin/chrome_plugin_host.cc b/chrome/plugin/chrome_plugin_host.cc index b93fbfe..ff9503f 100644 --- a/chrome/plugin/chrome_plugin_host.cc +++ b/chrome/plugin/chrome_plugin_host.cc @@ -33,6 +33,7 @@ namespace { using webkit_glue::ResourceLoaderBridge; +using webkit_glue::ResourceResponseInfo; static MessageLoop* g_plugin_thread_message_loop; @@ -71,7 +72,7 @@ class PluginRequestHandlerProxy virtual bool OnReceivedRedirect( const GURL& new_url, - const ResourceLoaderBridge::ResponseInfo& info, + const ResourceResponseInfo& info, bool* has_new_first_party_for_cookies, GURL* new_first_party_for_cookies) { plugin_->functions().response_funcs->received_redirect( @@ -82,7 +83,7 @@ class PluginRequestHandlerProxy } virtual void OnReceivedResponse( - const ResourceLoaderBridge::ResponseInfo& info, + const ResourceResponseInfo& info, bool content_filtered) { response_headers_ = info.headers; plugin_->functions().response_funcs->start_completed( diff --git a/webkit/glue/media/buffered_data_source.cc b/webkit/glue/media/buffered_data_source.cc index f4aad57..4feb0e6 100644 --- a/webkit/glue/media/buffered_data_source.cc +++ b/webkit/glue/media/buffered_data_source.cc @@ -235,7 +235,7 @@ void BufferedResourceLoader::SetAllowDefer(bool is_allowed) { // webkit_glue::ResourceLoaderBridge::Peer implementations bool BufferedResourceLoader::OnReceivedRedirect( const GURL& new_url, - const webkit_glue::ResourceLoaderBridge::ResponseInfo& info, + const webkit_glue::ResourceResponseInfo& info, bool* has_new_first_party_for_cookies, GURL* new_first_party_for_cookies) { DCHECK(bridge_.get()); @@ -259,7 +259,7 @@ bool BufferedResourceLoader::OnReceivedRedirect( } void BufferedResourceLoader::OnReceivedResponse( - const webkit_glue::ResourceLoaderBridge::ResponseInfo& info, + const webkit_glue::ResourceResponseInfo& info, bool content_filtered) { DCHECK(bridge_.get()); @@ -479,7 +479,7 @@ void BufferedResourceLoader::ReadInternal() { } bool BufferedResourceLoader::VerifyPartialResponse( - const ResourceLoaderBridge::ResponseInfo& info) { + const ResourceResponseInfo& info) { int64 first_byte_position, last_byte_position, instance_size; if (!info.headers->GetContentRange(&first_byte_position, &last_byte_position, diff --git a/webkit/glue/media/buffered_data_source.h b/webkit/glue/media/buffered_data_source.h index b520418..d07eb01 100644 --- a/webkit/glue/media/buffered_data_source.h +++ b/webkit/glue/media/buffered_data_source.h @@ -110,11 +110,11 @@ class BufferedResourceLoader : virtual void OnUploadProgress(uint64 position, uint64 size) {} virtual bool OnReceivedRedirect( const GURL& new_url, - const webkit_glue::ResourceLoaderBridge::ResponseInfo& info, + const webkit_glue::ResourceResponseInfo& info, bool* has_new_first_party_for_cookies, GURL* new_first_party_for_cookies); virtual void OnReceivedResponse( - const webkit_glue::ResourceLoaderBridge::ResponseInfo& info, + const webkit_glue::ResourceResponseInfo& info, bool content_filtered); virtual void OnDownloadedData(int len) {} virtual void OnReceivedData(const char* data, int len); @@ -150,7 +150,7 @@ class BufferedResourceLoader : void ReadInternal(); // If we have made a range request, verify the response from the server. - bool VerifyPartialResponse(const ResourceLoaderBridge::ResponseInfo& info); + bool VerifyPartialResponse(const ResourceResponseInfo& info); // Done with read. Invokes the read callback and reset parameters for the // read request. diff --git a/webkit/glue/media/buffered_data_source_unittest.cc b/webkit/glue/media/buffered_data_source_unittest.cc index 7254c92..2ba0087 100644 --- a/webkit/glue/media/buffered_data_source_unittest.cc +++ b/webkit/glue/media/buffered_data_source_unittest.cc @@ -99,7 +99,7 @@ class BufferedResourceLoaderTest : public testing::Test { void FullResponse(int64 instance_size) { EXPECT_CALL(*this, StartCallback(net::OK)); - ResourceLoaderBridge::ResponseInfo info; + ResourceResponseInfo info; std::string header = base::StringPrintf("HTTP/1.1 200 OK\n" "Content-Length: %" PRId64, instance_size); @@ -116,7 +116,7 @@ class BufferedResourceLoaderTest : public testing::Test { int64 instance_size) { EXPECT_CALL(*this, StartCallback(net::OK)); int64 content_length = last_position - first_position + 1; - ResourceLoaderBridge::ResponseInfo info; + ResourceResponseInfo info; std::string header = base::StringPrintf("HTTP/1.1 206 Partial Content\n" "Content-Range: bytes " "%" PRId64 "-%" PRId64 "/%" PRId64, @@ -213,7 +213,7 @@ TEST_F(BufferedResourceLoaderTest, MissingHttpHeader) { EXPECT_CALL(*bridge_, OnDestroy()) .WillOnce(Invoke(this, &BufferedResourceLoaderTest::ReleaseBridge)); - ResourceLoaderBridge::ResponseInfo info; + ResourceResponseInfo info; loader_->OnReceivedResponse(info, false); } @@ -228,7 +228,7 @@ TEST_F(BufferedResourceLoaderTest, BadHttpResponse) { EXPECT_CALL(*bridge_, OnDestroy()) .WillOnce(Invoke(this, &BufferedResourceLoaderTest::ReleaseBridge)); - ResourceLoaderBridge::ResponseInfo info; + ResourceResponseInfo info; info.headers = new net::HttpResponseHeaders("HTTP/1.1 404 Not Found\n"); loader_->OnReceivedResponse(info, false); } @@ -268,7 +268,7 @@ TEST_F(BufferedResourceLoaderTest, InvalidPartialResponse) { EXPECT_CALL(*bridge_, OnDestroy()) .WillOnce(Invoke(this, &BufferedResourceLoaderTest::ReleaseBridge)); - ResourceLoaderBridge::ResponseInfo info; + ResourceResponseInfo info; std::string header = base::StringPrintf("HTTP/1.1 206 Partial Content\n" "Content-Range: bytes %d-%d/%d", 1, 10, 1024); diff --git a/webkit/glue/media/simple_data_source.cc b/webkit/glue/media/simple_data_source.cc index 56deaeb..0b09edf 100644 --- a/webkit/glue/media/simple_data_source.cc +++ b/webkit/glue/media/simple_data_source.cc @@ -122,7 +122,7 @@ bool SimpleDataSource::IsStreaming() { bool SimpleDataSource::OnReceivedRedirect( const GURL& new_url, - const webkit_glue::ResourceLoaderBridge::ResponseInfo& info, + const webkit_glue::ResourceResponseInfo& info, bool* has_new_first_party_for_cookies, GURL* new_first_party_for_cookies) { SetURL(new_url); @@ -132,7 +132,7 @@ bool SimpleDataSource::OnReceivedRedirect( } void SimpleDataSource::OnReceivedResponse( - const webkit_glue::ResourceLoaderBridge::ResponseInfo& info, + const webkit_glue::ResourceResponseInfo& info, bool content_filtered) { size_ = info.content_length; } diff --git a/webkit/glue/media/simple_data_source.h b/webkit/glue/media/simple_data_source.h index d238f61..d649c0d 100644 --- a/webkit/glue/media/simple_data_source.h +++ b/webkit/glue/media/simple_data_source.h @@ -54,11 +54,11 @@ class SimpleDataSource : public media::DataSource, virtual void OnUploadProgress(uint64 position, uint64 size) {} virtual bool OnReceivedRedirect( const GURL& new_url, - const webkit_glue::ResourceLoaderBridge::ResponseInfo& info, + const webkit_glue::ResourceResponseInfo& info, bool* has_new_first_party_for_cookies, GURL* new_first_party_for_cookies); virtual void OnReceivedResponse( - const webkit_glue::ResourceLoaderBridge::ResponseInfo& info, + const webkit_glue::ResourceResponseInfo& info, bool content_filtered); virtual void OnDownloadedData(int len) {} virtual void OnReceivedData(const char* data, int len); diff --git a/webkit/glue/media/simple_data_source_unittest.cc b/webkit/glue/media/simple_data_source_unittest.cc index d05bb72..50c8910 100644 --- a/webkit/glue/media/simple_data_source_unittest.cc +++ b/webkit/glue/media/simple_data_source_unittest.cc @@ -81,7 +81,7 @@ class SimpleDataSourceTest : public testing::Test { } void RequestSucceeded(bool is_loaded) { - ResourceLoaderBridge::ResponseInfo info; + ResourceResponseInfo info; info.content_length = kDataSize; data_source_->OnReceivedResponse(info, false); diff --git a/webkit/glue/resource_loader_bridge.cc b/webkit/glue/resource_loader_bridge.cc index ab19082..fe4db75 100644 --- a/webkit/glue/resource_loader_bridge.cc +++ b/webkit/glue/resource_loader_bridge.cc @@ -9,6 +9,42 @@ namespace webkit_glue { +ResourceLoadTimingInfo::ResourceLoadTimingInfo() + : proxy_start(-1), + proxy_end(-1), + dns_start(-1), + dns_end(-1), + connect_start(-1), + connect_end(-1), + ssl_start(-1), + ssl_end(-1), + send_start(0), + send_end(0), + receive_headers_start(0), + receive_headers_end(0) { +} + +ResourceLoadTimingInfo::~ResourceLoadTimingInfo() { +} + +ResourceDevToolsInfo::ResourceDevToolsInfo() {} + +ResourceDevToolsInfo::~ResourceDevToolsInfo() {} + +ResourceResponseInfo::ResourceResponseInfo() + : content_length(-1), + appcache_id(appcache::kNoCacheId), + connection_id(0), + connection_reused(false), + was_fetched_via_spdy(false), + was_npn_negotiated(false), + was_alternate_protocol_available(false), + was_fetched_via_proxy(false) { +} + +ResourceResponseInfo::~ResourceResponseInfo() { +} + ResourceLoaderBridge::RequestInfo::RequestInfo() : load_flags(0), requestor_pid(0), @@ -22,38 +58,6 @@ ResourceLoaderBridge::RequestInfo::RequestInfo() ResourceLoaderBridge::RequestInfo::~RequestInfo() { } -ResourceLoaderBridge::LoadTimingInfo::LoadTimingInfo() { - proxy_start = -1; - proxy_end = -1; - dns_start = -1; - dns_end = -1; - connect_start = -1; - connect_end = -1; - ssl_start = -1; - ssl_end = -1; - send_start = 0; - send_end = 0; - receive_headers_start = 0; - receive_headers_end = 0; -} - -ResourceLoaderBridge::LoadTimingInfo::~LoadTimingInfo() { -} - -ResourceLoaderBridge::ResponseInfo::ResponseInfo() { - content_length = -1; - appcache_id = appcache::kNoCacheId; - was_fetched_via_spdy = false; - was_npn_negotiated = false; - connection_id = 0; - connection_reused = false; - was_alternate_protocol_available = false; - was_fetched_via_proxy = false; -} - -ResourceLoaderBridge::ResponseInfo::~ResponseInfo() { -} - ResourceLoaderBridge::SyncLoadResponse::SyncLoadResponse() { } diff --git a/webkit/glue/resource_loader_bridge.h b/webkit/glue/resource_loader_bridge.h index 99824b4..2634383 100644 --- a/webkit/glue/resource_loader_bridge.h +++ b/webkit/glue/resource_loader_bridge.h @@ -40,6 +40,148 @@ class HttpResponseHeaders; namespace webkit_glue { +// Structure containing timing information for the request. It addresses +// http://groups.google.com/group/http-archive-specification/web/har-1-1-spec +// and http://dev.w3.org/2006/webapi/WebTiming/ needs. +// +// All the values for starts and ends are given in milliseconds and are +// offsets with respect to the given base time. +struct ResourceLoadTimingInfo { + ResourceLoadTimingInfo(); + ~ResourceLoadTimingInfo(); + + // All the values in this struct are given as offsets in milliseconds wrt + // this base time. + base::Time base_time; + + // The time that proxy processing started. For requests with no proxy phase, + // this time is -1. + int32 proxy_start; + + // The time that proxy processing ended. For reused sockets this time + // is -1. + int32 proxy_end; + + // The time that DNS lookup started. For reused sockets this time is -1. + int32 dns_start; + + // The time that DNS lookup ended. For reused sockets this time is -1. + int32 dns_end; + + // The time that establishing connection started. Connect time includes + // DNS, blocking, TCP, TCP retries and SSL time. + int32 connect_start; + + // The time that establishing connection ended. Connect time includes + // DNS, blocking, TCP, TCP retries and SSL time. + int32 connect_end; + + // The time at which SSL handshake started. For non-HTTPS requests this + // is 0. + int32 ssl_start; + + // The time at which SSL handshake ended. For non-HTTPS requests this is 0. + int32 ssl_end; + + // The time that HTTP request started. For non-HTTP requests this is 0. + int32 send_start; + + // The time that HTTP request ended. For non-HTTP requests this is 0. + int32 send_end; + + // The time at which receiving HTTP headers started. For non-HTTP requests + // this is 0. + int32 receive_headers_start; + + // The time at which receiving HTTP headers ended. For non-HTTP requests + // this is 0. + int32 receive_headers_end; +}; + +struct ResourceDevToolsInfo : base::RefCounted<ResourceDevToolsInfo> { + typedef std::vector<std::pair<std::string, std::string> > + HeadersVector; + + ResourceDevToolsInfo(); + ~ResourceDevToolsInfo(); + + HeadersVector request_headers; + HeadersVector response_headers; +}; + +struct ResourceResponseInfo { + ResourceResponseInfo(); + ~ResourceResponseInfo(); + + // The time at which the request was made that resulted in this response. + // For cached responses, this time could be "far" in the past. + base::Time request_time; + + // The time at which the response headers were received. For cached + // responses, this time could be "far" in the past. + base::Time response_time; + + // The response headers or NULL if the URL type does not support headers. + scoped_refptr<net::HttpResponseHeaders> headers; + + // The mime type of the response. This may be a derived value. + std::string mime_type; + + // The character encoding of the response or none if not applicable to the + // response's mime type. This may be a derived value. + std::string charset; + + // An opaque string carrying security information pertaining to this + // response. This may include information about the SSL connection used. + std::string security_info; + + // Content length if available. -1 if not available + int64 content_length; + + // The appcache this response was loaded from, or kNoCacheId. + int64 appcache_id; + + // The manifest url of the appcache this response was loaded from. + // Note: this value is only populated for main resource requests. + GURL appcache_manifest_url; + + // Connection identifier from the underlying network stack. In case there + // is no associated connection, contains 0. + uint32 connection_id; + + // Determines whether physical connection reused. + bool connection_reused; + + // Detailed timing information used by the WebTiming, HAR and Developer + // Tools. + ResourceLoadTimingInfo load_timing; + + // Actual request and response headers, as obtained from the network stack. + // Only present if request had LOAD_REPORT_RAW_HEADERS in load_flags, and + // requesting renderer had CanReadRowCookies permission. + scoped_refptr<ResourceDevToolsInfo> devtools_info; + + // The path to a file that will contain the response body. It may only + // contain a portion of the response body at the time that the ResponseInfo + // becomes available. + FilePath download_file_path; + + // True if the response was delivered using SPDY. + bool was_fetched_via_spdy; + + // True if the response was delivered after NPN is negotiated. + bool was_npn_negotiated; + + // True if response could use alternate protocol. However, browser will + // ignore the alternate protocol when spdy is not enabled on browser side. + bool was_alternate_protocol_available; + + // True if the response was fetched via an explicit proxy (as opposed to a + // transparent proxy). The proxy could be any type of proxy, HTTP or SOCKS. + // Note: we cannot tell if a transparent proxy may have been involved. + bool was_fetched_via_proxy; +}; + class ResourceLoaderBridge { public: // Structure used when calling ResourceLoaderBridge::Create(). @@ -94,147 +236,9 @@ class ResourceLoaderBridge { bool download_to_file; }; - // Structure containing timing information for the request. It addresses - // http://groups.google.com/group/http-archive-specification/web/har-1-1-spec - // and http://dev.w3.org/2006/webapi/WebTiming/ needs. - // - // All the values for starts and ends are given in milliseconds and are - // offsets with respect to the given base time. - struct LoadTimingInfo { - LoadTimingInfo(); - ~LoadTimingInfo(); - - // All the values in this struct are given as offsets in milliseconds wrt - // this base time. - base::Time base_time; - - // The time that proxy processing started. For requests with no proxy phase, - // this time is -1. - int32 proxy_start; - - // The time that proxy processing ended. For reused sockets this time - // is -1. - int32 proxy_end; - - // The time that DNS lookup started. For reused sockets this time is -1. - int32 dns_start; - - // The time that DNS lookup ended. For reused sockets this time is -1. - int32 dns_end; - - // The time that establishing connection started. Connect time includes - // DNS, blocking, TCP, TCP retries and SSL time. - int32 connect_start; - - // The time that establishing connection ended. Connect time includes - // DNS, blocking, TCP, TCP retries and SSL time. - int32 connect_end; - - // The time at which SSL handshake started. For non-HTTPS requests this - // is 0. - int32 ssl_start; - - // The time at which SSL handshake ended. For non-HTTPS requests this is 0. - int32 ssl_end; - - // The time that HTTP request started. For non-HTTP requests this is 0. - int32 send_start; - - // The time that HTTP request ended. For non-HTTP requests this is 0. - int32 send_end; - - // The time at which receiving HTTP headers started. For non-HTTP requests - // this is 0. - int32 receive_headers_start; - - // The time at which receiving HTTP headers ended. For non-HTTP requests - // this is 0. - int32 receive_headers_end; - }; - - struct DevToolsInfo : base::RefCounted<DevToolsInfo> { - typedef std::vector<std::pair<std::string, std::string> > - HeadersVector; - HeadersVector request_headers; - HeadersVector response_headers; - }; - - struct ResponseInfo { - ResponseInfo(); - ~ResponseInfo(); - - // The time at which the request was made that resulted in this response. - // For cached responses, this time could be "far" in the past. - base::Time request_time; - - // The time at which the response headers were received. For cached - // responses, this time could be "far" in the past. - base::Time response_time; - - // The response headers or NULL if the URL type does not support headers. - scoped_refptr<net::HttpResponseHeaders> headers; - - // The mime type of the response. This may be a derived value. - std::string mime_type; - - // The character encoding of the response or none if not applicable to the - // response's mime type. This may be a derived value. - std::string charset; - - // An opaque string carrying security information pertaining to this - // response. This may include information about the SSL connection used. - std::string security_info; - - // Content length if available. -1 if not available - int64 content_length; - - // The appcache this response was loaded from, or kNoCacheId. - int64 appcache_id; - - // The manifest url of the appcache this response was loaded from. - // Note: this value is only populated for main resource requests. - GURL appcache_manifest_url; - - // Connection identifier from the underlying network stack. In case there - // is no associated connection, contains 0. - uint32 connection_id; - - // Determines whether physical connection reused. - bool connection_reused; - - // Detailed timing information used by the WebTiming, HAR and Developer - // Tools. - LoadTimingInfo load_timing; - - // Actual request and response headers, as obtained from the network stack. - // Only present if request had LOAD_REPORT_RAW_HEADERS in load_flags, and - // requesting renderer had CanReadRowCookies permission. - scoped_refptr<DevToolsInfo> devtools_info; - - // The path to a file that will contain the response body. It may only - // contain a portion of the response body at the time that the ResponseInfo - // becomes available. - FilePath download_file_path; - - // True if the response was delivered using SPDY. - bool was_fetched_via_spdy; - - // True if the response was delivered after NPN is negotiated. - bool was_npn_negotiated; - - // True if response could use alternate protocol. However, browser will - // ignore the alternate protocol when spdy is not enabled on browser side. - bool was_alternate_protocol_available; - - // True if the response was fetched via an explicit proxy (as opposed to a - // transparent proxy). The proxy could be any type of proxy, HTTP or SOCKS. - // Note: we cannot tell if a transparent proxy may have been involved. - bool was_fetched_via_proxy; - }; - // See the SyncLoad method declared below. (The name of this struct is not // suffixed with "Info" because it also contains the response data.) - struct SyncLoadResponse : ResponseInfo { + struct SyncLoadResponse : ResourceResponseInfo { SyncLoadResponse(); ~SyncLoadResponse(); @@ -272,7 +276,7 @@ class ResourceLoaderBridge { // output parameter *new_first_party_for_cookies contains the new URL that // should be consulted for the third-party cookie blocking policy. virtual bool OnReceivedRedirect(const GURL& new_url, - const ResponseInfo& info, + const ResourceResponseInfo& info, bool* has_new_first_party_for_cookies, GURL* new_first_party_for_cookies) = 0; @@ -280,7 +284,7 @@ class ResourceLoaderBridge { // been followed). |content_filtered| is set to true if the contents is // altered or replaced (usually for security reasons when the resource is // deemed unsafe). - virtual void OnReceivedResponse(const ResponseInfo& info, + virtual void OnReceivedResponse(const ResourceResponseInfo& info, bool content_filtered) = 0; // Called when a chunk of response data is downloaded. This method may be diff --git a/webkit/glue/weburlloader_impl.cc b/webkit/glue/weburlloader_impl.cc index 528cc19..374f1323 100644 --- a/webkit/glue/weburlloader_impl.cc +++ b/webkit/glue/weburlloader_impl.cc @@ -144,7 +144,7 @@ ResourceType::Type FromTargetType(WebURLRequest::TargetType type) { // Extracts the information from a data: url. bool GetInfoFromDataURL(const GURL& url, - ResourceLoaderBridge::ResponseInfo* info, + ResourceResponseInfo* info, std::string* data, URLRequestStatus* status) { std::string mime_type; std::string charset; @@ -165,11 +165,11 @@ bool GetInfoFromDataURL(const GURL& url, return false; } -typedef ResourceLoaderBridge::DevToolsInfo::HeadersVector HeadersVector; +typedef ResourceDevToolsInfo::HeadersVector HeadersVector; void PopulateURLResponse( const GURL& url, - const ResourceLoaderBridge::ResponseInfo& info, + const ResourceResponseInfo& info, WebURLResponse* response) { response->setURL(url); response->setResponseTime(info.response_time.ToDoubleT()); @@ -192,7 +192,7 @@ void PopulateURLResponse( WebURLLoadTiming timing; timing.initialize(); - const ResourceLoaderBridge::LoadTimingInfo& timing_info = info.load_timing; + const ResourceLoadTimingInfo& timing_info = info.load_timing; timing.setRequestTime(timing_info.base_time.ToDoubleT()); timing.setProxyStart(timing_info.proxy_start); timing.setProxyEnd(timing_info.proxy_end); @@ -281,11 +281,11 @@ class WebURLLoaderImpl::Context : public base::RefCounted<Context>, virtual void OnUploadProgress(uint64 position, uint64 size); virtual bool OnReceivedRedirect( const GURL& new_url, - const ResourceLoaderBridge::ResponseInfo& info, + const ResourceResponseInfo& info, bool* has_new_first_party_for_cookies, GURL* new_first_party_for_cookies); virtual void OnReceivedResponse( - const ResourceLoaderBridge::ResponseInfo& info, bool content_filtered); + const ResourceResponseInfo& info, bool content_filtered); virtual void OnDownloadedData(int len); virtual void OnReceivedData(const char* data, int len); virtual void OnReceivedCachedMetadata(const char* data, int len); @@ -488,7 +488,7 @@ void WebURLLoaderImpl::Context::OnUploadProgress(uint64 position, uint64 size) { bool WebURLLoaderImpl::Context::OnReceivedRedirect( const GURL& new_url, - const ResourceLoaderBridge::ResponseInfo& info, + const ResourceResponseInfo& info, bool* has_new_first_party_for_cookies, GURL* new_first_party_for_cookies) { if (!client_) @@ -528,7 +528,7 @@ bool WebURLLoaderImpl::Context::OnReceivedRedirect( } void WebURLLoaderImpl::Context::OnReceivedResponse( - const ResourceLoaderBridge::ResponseInfo& info, + const ResourceResponseInfo& info, bool content_filtered) { if (!client_) return; @@ -663,7 +663,7 @@ GURL WebURLLoaderImpl::Context::GetURLForDebugging() const { } void WebURLLoaderImpl::Context::HandleDataURL() { - ResourceLoaderBridge::ResponseInfo info; + ResourceResponseInfo info; URLRequestStatus status; std::string data; diff --git a/webkit/tools/test_shell/simple_resource_loader_bridge.cc b/webkit/tools/test_shell/simple_resource_loader_bridge.cc index 1feb389..a4ef5e7 100644 --- a/webkit/tools/test_shell/simple_resource_loader_bridge.cc +++ b/webkit/tools/test_shell/simple_resource_loader_bridge.cc @@ -73,6 +73,7 @@ #include "webkit/tools/test_shell/test_shell_webblobregistry_impl.h" using webkit_glue::ResourceLoaderBridge; +using webkit_glue::ResourceResponseInfo; using net::StaticCookiePolicy; using net::HttpResponseHeaders; using webkit_blob::DeletableFileReference; @@ -233,7 +234,7 @@ class RequestProxy : public URLRequest::Delegate, // these methods asynchronously. void NotifyReceivedRedirect(const GURL& new_url, - const ResourceLoaderBridge::ResponseInfo& info) { + const ResourceResponseInfo& info) { bool has_new_first_party_for_cookies = false; GURL new_first_party_for_cookies; if (peer_ && peer_->OnReceivedRedirect(new_url, info, @@ -247,7 +248,7 @@ class RequestProxy : public URLRequest::Delegate, } } - void NotifyReceivedResponse(const ResourceLoaderBridge::ResponseInfo& info, + void NotifyReceivedResponse(const ResourceResponseInfo& info, bool content_filtered) { if (peer_) peer_->OnReceivedResponse(info, content_filtered); @@ -391,7 +392,7 @@ class RequestProxy : public URLRequest::Delegate, virtual void OnReceivedRedirect( const GURL& new_url, - const ResourceLoaderBridge::ResponseInfo& info, + const ResourceResponseInfo& info, bool* defer_redirect) { *defer_redirect = true; // See AsyncFollowDeferredRedirect owner_loop_->PostTask(FROM_HERE, NewRunnableMethod( @@ -399,7 +400,7 @@ class RequestProxy : public URLRequest::Delegate, } virtual void OnReceivedResponse( - const ResourceLoaderBridge::ResponseInfo& info, + const ResourceResponseInfo& info, bool content_filtered) { owner_loop_->PostTask(FROM_HERE, NewRunnableMethod( this, &RequestProxy::NotifyReceivedResponse, info, content_filtered)); @@ -437,14 +438,14 @@ class RequestProxy : public URLRequest::Delegate, const GURL& new_url, bool* defer_redirect) { DCHECK(request->status().is_success()); - ResourceLoaderBridge::ResponseInfo info; + ResourceResponseInfo info; PopulateResponseInfo(request, &info); OnReceivedRedirect(new_url, info, defer_redirect); } virtual void OnResponseStarted(URLRequest* request) { if (request->status().is_success()) { - ResourceLoaderBridge::ResponseInfo info; + ResourceResponseInfo info; PopulateResponseInfo(request, &info); OnReceivedResponse(info, false); AsyncReadData(); // start reading @@ -517,7 +518,7 @@ class RequestProxy : public URLRequest::Delegate, } void PopulateResponseInfo(URLRequest* request, - ResourceLoaderBridge::ResponseInfo* info) const { + ResourceResponseInfo* info) const { info->request_time = request->request_time(); info->response_time = request->response_time(); info->headers = request->response_headers(); @@ -578,7 +579,7 @@ class SyncRequestProxy : public RequestProxy { virtual void OnReceivedRedirect( const GURL& new_url, - const ResourceLoaderBridge::ResponseInfo& info, + const ResourceResponseInfo& info, bool* defer_redirect) { // TODO(darin): It would be much better if this could live in WebCore, but // doing so requires API changes at all levels. Similar code exists in @@ -592,9 +593,9 @@ class SyncRequestProxy : public RequestProxy { } virtual void OnReceivedResponse( - const ResourceLoaderBridge::ResponseInfo& info, + const ResourceResponseInfo& info, bool content_filtered) { - *static_cast<ResourceLoaderBridge::ResponseInfo*>(result_) = info; + *static_cast<ResourceResponseInfo*>(result_) = info; } virtual void OnReceivedData(int bytes_read) { |