| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 const GURL& policy_url, | 48 const GURL& policy_url, |
| 49 const GURL& referrer, | 49 const GURL& referrer, |
| 50 const std::string& frame_origin, | 50 const std::string& frame_origin, |
| 51 const std::string& main_frame_origin, | 51 const std::string& main_frame_origin, |
| 52 const std::string& headers, | 52 const std::string& headers, |
| 53 const std::string& default_mime_type, | 53 const std::string& default_mime_type, |
| 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 route_id); | 59 int route_id); |
| 59 virtual ~IPCResourceLoaderBridge(); | 60 virtual ~IPCResourceLoaderBridge(); |
| 60 | 61 |
| 61 // ResourceLoaderBridge | 62 // ResourceLoaderBridge |
| 62 virtual void AppendDataToUpload(const char* data, int data_len); | 63 virtual void AppendDataToUpload(const char* data, int data_len); |
| 63 virtual void AppendFileRangeToUpload(const std::wstring& path, | 64 virtual void AppendFileRangeToUpload(const std::wstring& path, |
| 64 uint64 offset, uint64 length); | 65 uint64 offset, uint64 length); |
| 65 virtual void SetUploadIdentifier(int64 identifier); | 66 virtual void SetUploadIdentifier(int64 identifier); |
| 66 virtual bool Start(Peer* peer); | 67 virtual bool Start(Peer* peer); |
| 67 virtual void Cancel(); | 68 virtual void Cancel(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 const GURL& policy_url, | 103 const GURL& policy_url, |
| 103 const GURL& referrer, | 104 const GURL& referrer, |
| 104 const std::string& frame_origin, | 105 const std::string& frame_origin, |
| 105 const std::string& main_frame_origin, | 106 const std::string& main_frame_origin, |
| 106 const std::string& headers, | 107 const std::string& headers, |
| 107 const std::string& default_mime_type, | 108 const std::string& default_mime_type, |
| 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, |
| 113 int app_cache_context_id, |
| 112 int route_id) | 114 int route_id) |
| 113 : peer_(NULL), | 115 : peer_(NULL), |
| 114 dispatcher_(dispatcher), | 116 dispatcher_(dispatcher), |
| 115 request_id_(-1), | 117 request_id_(-1), |
| 116 route_id_(route_id) { | 118 route_id_(route_id) { |
| 117 DCHECK(dispatcher_) << "no resource dispatcher"; | 119 DCHECK(dispatcher_) << "no resource dispatcher"; |
| 118 request_.method = method; | 120 request_.method = method; |
| 119 request_.url = url; | 121 request_.url = url; |
| 120 request_.policy_url = policy_url; | 122 request_.policy_url = policy_url; |
| 121 request_.referrer = referrer; | 123 request_.referrer = referrer; |
| 122 request_.frame_origin = frame_origin; | 124 request_.frame_origin = frame_origin; |
| 123 request_.main_frame_origin = main_frame_origin; | 125 request_.main_frame_origin = main_frame_origin; |
| 124 request_.headers = headers; | 126 request_.headers = headers; |
| 125 request_.default_mime_type = default_mime_type; | 127 request_.default_mime_type = default_mime_type; |
| 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; |
| 132 request_.app_cache_context_id = app_cache_context_id; |
| 130 | 133 |
| 131 #ifdef LOG_RESOURCE_REQUESTS | 134 #ifdef LOG_RESOURCE_REQUESTS |
| 132 url_ = url.possibly_invalid_spec(); | 135 url_ = url.possibly_invalid_spec(); |
| 133 #endif | 136 #endif |
| 134 } | 137 } |
| 135 | 138 |
| 136 IPCResourceLoaderBridge::~IPCResourceLoaderBridge() { | 139 IPCResourceLoaderBridge::~IPCResourceLoaderBridge() { |
| 137 // we remove our hook for the resource dispatcher only when going away, since | 140 // we remove our hook for the resource dispatcher only when going away, since |
| 138 // it doesn't keep track of whether we've force terminated the request | 141 // it doesn't keep track of whether we've force terminated the request |
| 139 if (request_id_ >= 0) { | 142 if (request_id_ >= 0) { |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 const GURL& policy_url, | 526 const GURL& policy_url, |
| 524 const GURL& referrer, | 527 const GURL& referrer, |
| 525 const std::string& frame_origin, | 528 const std::string& frame_origin, |
| 526 const std::string& main_frame_origin, | 529 const std::string& main_frame_origin, |
| 527 const std::string& headers, | 530 const std::string& headers, |
| 528 const std::string& default_mime_type, | 531 const std::string& default_mime_type, |
| 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, |
| 536 int app_cache_context_id, |
| 533 int route_id) { | 537 int route_id) { |
| 534 return new webkit_glue::IPCResourceLoaderBridge(this, method, url, policy_url, | 538 return new webkit_glue::IPCResourceLoaderBridge(this, method, url, policy_url, |
| 535 referrer, frame_origin, | 539 referrer, frame_origin, |
| 536 main_frame_origin, headers, | 540 main_frame_origin, headers, |
| 537 default_mime_type, | 541 default_mime_type, |
| 538 flags, origin_pid, | 542 flags, origin_pid, |
| 539 resource_type, | 543 resource_type, |
| 540 request_context, route_id); | 544 request_context, |
| 545 app_cache_context_id, |
| 546 route_id); |
| 541 } | 547 } |
| 542 | 548 |
| 543 bool ResourceDispatcher::IsResourceDispatcherMessage( | 549 bool ResourceDispatcher::IsResourceDispatcherMessage( |
| 544 const IPC::Message& message) { | 550 const IPC::Message& message) { |
| 545 switch (message.type()) { | 551 switch (message.type()) { |
| 546 case ViewMsg_Resource_DownloadProgress::ID: | 552 case ViewMsg_Resource_DownloadProgress::ID: |
| 547 case ViewMsg_Resource_UploadProgress::ID: | 553 case ViewMsg_Resource_UploadProgress::ID: |
| 548 case ViewMsg_Resource_ReceivedResponse::ID: | 554 case ViewMsg_Resource_ReceivedResponse::ID: |
| 549 case ViewMsg_Resource_ReceivedRedirect::ID: | 555 case ViewMsg_Resource_ReceivedRedirect::ID: |
| 550 case ViewMsg_Resource_DataReceived::ID: | 556 case ViewMsg_Resource_DataReceived::ID: |
| 551 case ViewMsg_Resource_RequestComplete::ID: | 557 case ViewMsg_Resource_RequestComplete::ID: |
| 552 return true; | 558 return true; |
| 553 | 559 |
| 554 default: | 560 default: |
| 555 break; | 561 break; |
| 556 } | 562 } |
| 557 | 563 |
| 558 return false; | 564 return false; |
| 559 } | 565 } |
| OLD | NEW |