| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading | 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading |
| 6 | 6 |
| 7 #include "chrome/common/resource_dispatcher.h" | 7 #include "chrome/common/resource_dispatcher.h" |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 const GURL& policy_url, | 49 const GURL& policy_url, |
| 50 const GURL& referrer, | 50 const GURL& referrer, |
| 51 const std::string& frame_origin, | 51 const std::string& frame_origin, |
| 52 const std::string& main_frame_origin, | 52 const std::string& main_frame_origin, |
| 53 const std::string& headers, | 53 const std::string& headers, |
| 54 int load_flags, | 54 int load_flags, |
| 55 int origin_pid, | 55 int origin_pid, |
| 56 ResourceType::Type resource_type, | 56 ResourceType::Type resource_type, |
| 57 uint32 request_context, | 57 uint32 request_context, |
| 58 int app_cache_context_id, | 58 int app_cache_context_id, |
| 59 int route_id); | 59 int route_id, |
| 60 const std::string& disposition_fallback_charset); |
| 60 virtual ~IPCResourceLoaderBridge(); | 61 virtual ~IPCResourceLoaderBridge(); |
| 61 | 62 |
| 62 // ResourceLoaderBridge | 63 // ResourceLoaderBridge |
| 63 virtual void AppendDataToUpload(const char* data, int data_len); | 64 virtual void AppendDataToUpload(const char* data, int data_len); |
| 64 virtual void AppendFileRangeToUpload(const FilePath& path, | 65 virtual void AppendFileRangeToUpload(const FilePath& path, |
| 65 uint64 offset, uint64 length); | 66 uint64 offset, uint64 length); |
| 66 virtual void SetUploadIdentifier(int64 identifier); | 67 virtual void SetUploadIdentifier(int64 identifier); |
| 67 virtual bool Start(Peer* peer); | 68 virtual bool Start(Peer* peer); |
| 68 virtual void Cancel(); | 69 virtual void Cancel(); |
| 69 virtual void SetDefersLoading(bool value); | 70 virtual void SetDefersLoading(bool value); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 const GURL& policy_url, | 104 const GURL& policy_url, |
| 104 const GURL& referrer, | 105 const GURL& referrer, |
| 105 const std::string& frame_origin, | 106 const std::string& frame_origin, |
| 106 const std::string& main_frame_origin, | 107 const std::string& main_frame_origin, |
| 107 const std::string& headers, | 108 const std::string& headers, |
| 108 int load_flags, | 109 int load_flags, |
| 109 int origin_pid, | 110 int origin_pid, |
| 110 ResourceType::Type resource_type, | 111 ResourceType::Type resource_type, |
| 111 uint32 request_context, | 112 uint32 request_context, |
| 112 int app_cache_context_id, | 113 int app_cache_context_id, |
| 113 int route_id) | 114 int route_id, |
| 115 const std::string& disposition_fallback_charset) |
| 114 : peer_(NULL), | 116 : peer_(NULL), |
| 115 dispatcher_(dispatcher), | 117 dispatcher_(dispatcher), |
| 116 request_id_(-1), | 118 request_id_(-1), |
| 117 route_id_(route_id) { | 119 route_id_(route_id) { |
| 118 DCHECK(dispatcher_) << "no resource dispatcher"; | 120 DCHECK(dispatcher_) << "no resource dispatcher"; |
| 119 request_.method = method; | 121 request_.method = method; |
| 120 request_.url = url; | 122 request_.url = url; |
| 121 request_.policy_url = policy_url; | 123 request_.policy_url = policy_url; |
| 122 request_.referrer = referrer; | 124 request_.referrer = referrer; |
| 123 request_.frame_origin = frame_origin; | 125 request_.frame_origin = frame_origin; |
| 124 request_.main_frame_origin = main_frame_origin; | 126 request_.main_frame_origin = main_frame_origin; |
| 125 request_.headers = headers; | 127 request_.headers = headers; |
| 126 request_.load_flags = load_flags; | 128 request_.load_flags = load_flags; |
| 127 request_.origin_pid = origin_pid; | 129 request_.origin_pid = origin_pid; |
| 128 request_.resource_type = resource_type; | 130 request_.resource_type = resource_type; |
| 129 request_.request_context = request_context; | 131 request_.request_context = request_context; |
| 130 request_.app_cache_context_id = app_cache_context_id; | 132 request_.app_cache_context_id = app_cache_context_id; |
| 133 request_.disposition_fallback_charset = disposition_fallback_charset; |
| 131 | 134 |
| 132 #ifdef LOG_RESOURCE_REQUESTS | 135 #ifdef LOG_RESOURCE_REQUESTS |
| 133 url_ = url.possibly_invalid_spec(); | 136 url_ = url.possibly_invalid_spec(); |
| 134 #endif | 137 #endif |
| 135 } | 138 } |
| 136 | 139 |
| 137 IPCResourceLoaderBridge::~IPCResourceLoaderBridge() { | 140 IPCResourceLoaderBridge::~IPCResourceLoaderBridge() { |
| 138 // we remove our hook for the resource dispatcher only when going away, since | 141 // we remove our hook for the resource dispatcher only when going away, since |
| 139 // it doesn't keep track of whether we've force terminated the request | 142 // it doesn't keep track of whether we've force terminated the request |
| 140 if (request_id_ >= 0) { | 143 if (request_id_ >= 0) { |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 const GURL& policy_url, | 527 const GURL& policy_url, |
| 525 const GURL& referrer, | 528 const GURL& referrer, |
| 526 const std::string& frame_origin, | 529 const std::string& frame_origin, |
| 527 const std::string& main_frame_origin, | 530 const std::string& main_frame_origin, |
| 528 const std::string& headers, | 531 const std::string& headers, |
| 529 int flags, | 532 int flags, |
| 530 int origin_pid, | 533 int origin_pid, |
| 531 ResourceType::Type resource_type, | 534 ResourceType::Type resource_type, |
| 532 uint32 request_context, | 535 uint32 request_context, |
| 533 int app_cache_context_id, | 536 int app_cache_context_id, |
| 534 int route_id) { | 537 int route_id, |
| 538 const std::string& disposition_fallback_charset) { |
| 535 return new webkit_glue::IPCResourceLoaderBridge(this, method, url, policy_url, | 539 return new webkit_glue::IPCResourceLoaderBridge(this, method, url, policy_url, |
| 536 referrer, frame_origin, | 540 referrer, frame_origin, |
| 537 main_frame_origin, headers, | 541 main_frame_origin, headers, |
| 538 flags, origin_pid, | 542 flags, origin_pid, |
| 539 resource_type, | 543 resource_type, |
| 540 request_context, | 544 request_context, |
| 541 app_cache_context_id, | 545 app_cache_context_id, |
| 542 route_id); | 546 route_id, |
| 547 disposition_fallback_charset); |
| 543 } | 548 } |
| 544 | 549 |
| 545 bool ResourceDispatcher::IsResourceDispatcherMessage( | 550 bool ResourceDispatcher::IsResourceDispatcherMessage( |
| 546 const IPC::Message& message) { | 551 const IPC::Message& message) { |
| 547 switch (message.type()) { | 552 switch (message.type()) { |
| 548 case ViewMsg_Resource_DownloadProgress::ID: | 553 case ViewMsg_Resource_DownloadProgress::ID: |
| 549 case ViewMsg_Resource_UploadProgress::ID: | 554 case ViewMsg_Resource_UploadProgress::ID: |
| 550 case ViewMsg_Resource_ReceivedResponse::ID: | 555 case ViewMsg_Resource_ReceivedResponse::ID: |
| 551 case ViewMsg_Resource_ReceivedRedirect::ID: | 556 case ViewMsg_Resource_ReceivedRedirect::ID: |
| 552 case ViewMsg_Resource_DataReceived::ID: | 557 case ViewMsg_Resource_DataReceived::ID: |
| 553 case ViewMsg_Resource_RequestComplete::ID: | 558 case ViewMsg_Resource_RequestComplete::ID: |
| 554 return true; | 559 return true; |
| 555 | 560 |
| 556 default: | 561 default: |
| 557 break; | 562 break; |
| 558 } | 563 } |
| 559 | 564 |
| 560 return false; | 565 return false; |
| 561 } | 566 } |
| OLD | NEW |