Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Side by Side Diff: chrome/browser/renderer_host/resource_dispatcher_host.cc

Issue 27168: IPC messages and changes to ResourceLoaderBridge to support resource loading for media (Closed)
Patch Set: add mac/linux build and fixed unit test failures Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/browser/renderer_host/resource_dispatcher_host.h" 7 #include "chrome/browser/renderer_host/resource_dispatcher_host.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/scoped_ptr.h" 12 #include "base/scoped_ptr.h"
13 #include "base/time.h" 13 #include "base/time.h"
14 #include "chrome/browser/cert_store.h" 14 #include "chrome/browser/cert_store.h"
15 #include "chrome/browser/cross_site_request_manager.h" 15 #include "chrome/browser/cross_site_request_manager.h"
16 #include "chrome/browser/download/download_file.h" 16 #include "chrome/browser/download/download_file.h"
17 #include "chrome/browser/download/download_manager.h" 17 #include "chrome/browser/download/download_manager.h"
18 #include "chrome/browser/download/download_request_manager.h" 18 #include "chrome/browser/download/download_request_manager.h"
19 #include "chrome/browser/download/save_file_manager.h" 19 #include "chrome/browser/download/save_file_manager.h"
20 #include "chrome/browser/plugin_service.h" 20 #include "chrome/browser/plugin_service.h"
21 #include "chrome/browser/renderer_host/async_resource_handler.h" 21 #include "chrome/browser/renderer_host/async_resource_handler.h"
22 #include "chrome/browser/renderer_host/buffered_resource_handler.h" 22 #include "chrome/browser/renderer_host/buffered_resource_handler.h"
23 #include "chrome/browser/renderer_host/cross_site_resource_handler.h" 23 #include "chrome/browser/renderer_host/cross_site_resource_handler.h"
24 #include "chrome/browser/renderer_host/download_resource_handler.h" 24 #include "chrome/browser/renderer_host/download_resource_handler.h"
25 #include "chrome/browser/renderer_host/media_resource_handler.h"
25 #include "chrome/browser/renderer_host/render_view_host.h" 26 #include "chrome/browser/renderer_host/render_view_host.h"
26 #include "chrome/browser/renderer_host/renderer_security_policy.h" 27 #include "chrome/browser/renderer_host/renderer_security_policy.h"
27 #include "chrome/browser/renderer_host/resource_request_details.h" 28 #include "chrome/browser/renderer_host/resource_request_details.h"
28 #include "chrome/browser/renderer_host/safe_browsing_resource_handler.h" 29 #include "chrome/browser/renderer_host/safe_browsing_resource_handler.h"
29 #include "chrome/browser/renderer_host/save_file_resource_handler.h" 30 #include "chrome/browser/renderer_host/save_file_resource_handler.h"
30 #include "chrome/browser/renderer_host/sync_resource_handler.h" 31 #include "chrome/browser/renderer_host/sync_resource_handler.h"
31 #include "chrome/browser/tab_contents/tab_util.h" 32 #include "chrome/browser/tab_contents/tab_util.h"
32 #include "chrome/browser/tab_contents/web_contents.h" 33 #include "chrome/browser/tab_contents/web_contents.h"
33 #include "chrome/common/notification_service.h" 34 #include "chrome/common/notification_service.h"
34 #include "chrome/common/render_messages.h" 35 #include "chrome/common/render_messages.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 scoped_refptr<ResourceHandler> handler; 242 scoped_refptr<ResourceHandler> handler;
242 if (sync_result) { 243 if (sync_result) {
243 handler = new SyncResourceHandler(receiver, request_data.url, sync_result); 244 handler = new SyncResourceHandler(receiver, request_data.url, sync_result);
244 } else { 245 } else {
245 handler = new AsyncResourceHandler(receiver, 246 handler = new AsyncResourceHandler(receiver,
246 process_id, 247 process_id,
247 route_id, 248 route_id,
248 process_handle, 249 process_handle,
249 request_data.url, 250 request_data.url,
250 this); 251 this);
252 // If the resource type is ResourceType::MEDIA and LOAD_ENABLE_DOWNLOAD_FILE
253 // is enabled we insert a media resource handler.
254 if (request_data.resource_type == ResourceType::MEDIA &&
255 (request_data.load_flags & net::LOAD_ENABLE_DOWNLOAD_FILE)) {
256 handler = new MediaResourceHandler(handler,
257 receiver,
258 process_id,
259 route_id,
260 process_handle,
261 this);
262 }
251 } 263 }
252 264
253 if (HandleExternalProtocol(request_id, process_id, route_id, 265 if (HandleExternalProtocol(request_id, process_id, route_id,
254 request_data.url, request_data.resource_type, 266 request_data.url, request_data.resource_type,
255 handler)) { 267 handler)) {
256 return; 268 return;
257 } 269 }
258 270
259 // Construct the request. 271 // Construct the request.
260 URLRequest* request = new URLRequest(request_data.url, this); 272 URLRequest* request = new URLRequest(request_data.url, this);
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 if (info->pending_data_count == kMaxPendingDataMessages) { 518 if (info->pending_data_count == kMaxPendingDataMessages) {
507 // Decrement the pending data count one more time because we also 519 // Decrement the pending data count one more time because we also
508 // incremented it before pausing the request. 520 // incremented it before pausing the request.
509 info->pending_data_count--; 521 info->pending_data_count--;
510 522
511 // Resume the request. 523 // Resume the request.
512 PauseRequest(process_id, request_id, false); 524 PauseRequest(process_id, request_id, false);
513 } 525 }
514 } 526 }
515 527
528 void ResourceDispatcherHost::OnDownloadProgressACK(int process_id,
529 int request_id) {
530 // TODO(hclam): do something to help rate limiting the message.
531 }
532
516 void ResourceDispatcherHost::OnUploadProgressACK(int process_id, 533 void ResourceDispatcherHost::OnUploadProgressACK(int process_id,
517 int request_id) { 534 int request_id) {
518 PendingRequestList::iterator i = pending_requests_.find( 535 PendingRequestList::iterator i = pending_requests_.find(
519 GlobalRequestID(process_id, request_id)); 536 GlobalRequestID(process_id, request_id));
520 if (i == pending_requests_.end()) 537 if (i == pending_requests_.end())
521 return; 538 return;
522 539
523 ExtraRequestInfo* info = ExtraInfoForRequest(i->second); 540 ExtraRequestInfo* info = ExtraInfoForRequest(i->second);
524 info->waiting_for_upload_progress_ack = false; 541 info->waiting_for_upload_progress_ack = false;
525 } 542 }
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 821
805 response->response_head.status = request->status(); 822 response->response_head.status = request->status();
806 response->response_head.request_time = request->request_time(); 823 response->response_head.request_time = request->request_time();
807 response->response_head.response_time = request->response_time(); 824 response->response_head.response_time = request->response_time();
808 response->response_head.headers = request->response_headers(); 825 response->response_head.headers = request->response_headers();
809 request->GetCharset(&response->response_head.charset); 826 request->GetCharset(&response->response_head.charset);
810 response->response_head.filter_policy = info->filter_policy; 827 response->response_head.filter_policy = info->filter_policy;
811 response->response_head.content_length = request->GetExpectedContentSize(); 828 response->response_head.content_length = request->GetExpectedContentSize();
812 request->GetMimeType(&response->response_head.mime_type); 829 request->GetMimeType(&response->response_head.mime_type);
813 830
831 // Make sure we don't get a file handle if LOAD_ENABLE_FILE is not set.
832 DCHECK((request->load_flags() & net::LOAD_ENABLE_DOWNLOAD_FILE) ||
833 request->response_data_file() == base::kInvalidPlatformFileValue);
834 #if defined(OS_POSIX)
835 response->response_head.response_data_file.fd = request->response_data_file();
836 #elif defined(OS_WIN)
837 response->response_head.response_data_file = request->response_data_file();
838 #endif
839
814 if (request->ssl_info().cert) { 840 if (request->ssl_info().cert) {
815 int cert_id = 841 int cert_id =
816 CertStore::GetSharedInstance()->StoreCert( 842 CertStore::GetSharedInstance()->StoreCert(
817 request->ssl_info().cert, 843 request->ssl_info().cert,
818 info->process_id); 844 info->process_id);
819 int cert_status = request->ssl_info().cert_status; 845 int cert_status = request->ssl_info().cert_status;
820 // EV certificate verification could be expensive. We don't want to spend 846 // EV certificate verification could be expensive. We don't want to spend
821 // time performing EV certificate verification on all resources because 847 // time performing EV certificate verification on all resources because
822 // EV status is irrelevant to sub-frames and sub-resources. So we call 848 // EV status is irrelevant to sub-frames and sub-resources. So we call
823 // IsEV here rather than in the network layer because the network layer 849 // IsEV here rather than in the network layer because the network layer
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
1425 IncrementOutstandingRequestsMemoryCost(-1 * info->memory_cost, 1451 IncrementOutstandingRequestsMemoryCost(-1 * info->memory_cost,
1426 info->process_id); 1452 info->process_id);
1427 if (cancel_requests) 1453 if (cancel_requests)
1428 delete req_iter->url_request; 1454 delete req_iter->url_request;
1429 else 1455 else
1430 BeginRequestInternal(req_iter->url_request, req_iter->mixed_content); 1456 BeginRequestInternal(req_iter->url_request, req_iter->mixed_content);
1431 } 1457 }
1432 1458
1433 delete requests; 1459 delete requests;
1434 } 1460 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/resource_dispatcher_host.h ('k') | chrome/browser/renderer_host/resource_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698