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

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

Issue 6025009: Get rid of RenderViewHostDelegate::Resource and dispatch the IPC messages dir... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "chrome/browser/renderer_host/resource_request_details.h" 47 #include "chrome/browser/renderer_host/resource_request_details.h"
48 #include "chrome/browser/renderer_host/safe_browsing_resource_handler.h" 48 #include "chrome/browser/renderer_host/safe_browsing_resource_handler.h"
49 #include "chrome/browser/renderer_host/save_file_resource_handler.h" 49 #include "chrome/browser/renderer_host/save_file_resource_handler.h"
50 #include "chrome/browser/renderer_host/sync_resource_handler.h" 50 #include "chrome/browser/renderer_host/sync_resource_handler.h"
51 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 51 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
52 #include "chrome/browser/ssl/ssl_client_auth_handler.h" 52 #include "chrome/browser/ssl/ssl_client_auth_handler.h"
53 #include "chrome/browser/ssl/ssl_manager.h" 53 #include "chrome/browser/ssl/ssl_manager.h"
54 #include "chrome/browser/ui/login/login_prompt.h" 54 #include "chrome/browser/ui/login/login_prompt.h"
55 #include "chrome/browser/worker_host/worker_service.h" 55 #include "chrome/browser/worker_host/worker_service.h"
56 #include "chrome/common/chrome_switches.h" 56 #include "chrome/common/chrome_switches.h"
57 #include "chrome/common/notification_service.h"
57 #include "chrome/common/render_messages.h" 58 #include "chrome/common/render_messages.h"
58 #include "chrome/common/render_messages_params.h" 59 #include "chrome/common/render_messages_params.h"
59 #include "chrome/common/url_constants.h" 60 #include "chrome/common/url_constants.h"
60 #include "net/base/auth.h" 61 #include "net/base/auth.h"
61 #include "net/base/cert_status_flags.h" 62 #include "net/base/cert_status_flags.h"
62 #include "net/base/load_flags.h" 63 #include "net/base/load_flags.h"
63 #include "net/base/mime_util.h" 64 #include "net/base/mime_util.h"
64 #include "net/base/net_errors.h" 65 #include "net/base/net_errors.h"
65 #include "net/base/request_priority.h" 66 #include "net/base/request_priority.h"
66 #include "net/base/ssl_cert_request_info.h" 67 #include "net/base/ssl_cert_request_info.h"
(...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after
1559 child_id); 1560 child_id);
1560 } 1561 }
1561 return 0; 1562 return 0;
1562 } 1563 }
1563 1564
1564 void ResourceDispatcherHost::NotifyResponseStarted(net::URLRequest* request, 1565 void ResourceDispatcherHost::NotifyResponseStarted(net::URLRequest* request,
1565 int child_id) { 1566 int child_id) {
1566 // Notify the observers on the IO thread. 1567 // Notify the observers on the IO thread.
1567 FOR_EACH_OBSERVER(Observer, observer_list_, OnRequestStarted(this, request)); 1568 FOR_EACH_OBSERVER(Observer, observer_list_, OnRequestStarted(this, request));
1568 1569
1569 int render_process_id, render_view_id;
1570 if (!RenderViewForRequest(request, &render_process_id, &render_view_id))
1571 return;
1572
1573 // Notify the observers on the UI thread. 1570 // Notify the observers on the UI thread.
1574 CallRenderViewHostResourceDelegate( 1571 ResourceRequestDetails* detail = new ResourceRequestDetails(
1575 render_process_id, render_view_id, 1572 request, GetCertID(request, child_id));
1576 &RenderViewHostDelegate::Resource::DidStartReceivingResourceResponse, 1573 BrowserThread::PostTask(
1577 ResourceRequestDetails(request, GetCertID(request, child_id))); 1574 BrowserThread::UI, FROM_HERE,
1575 NewRunnableFunction(
1576 &ResourceDispatcherHost::NotifyOnUI<ResourceRequestDetails>,
1577 NotificationType::RESOURCE_RESPONSE_STARTED,
1578 detail));
1578 } 1579 }
1579 1580
1580 void ResourceDispatcherHost::NotifyResponseCompleted(net::URLRequest* request, 1581 void ResourceDispatcherHost::NotifyResponseCompleted(net::URLRequest* request,
1581 int child_id) { 1582 int child_id) {
1582 // Notify the observers on the IO thread. 1583 // Notify the observers on the IO thread.
1583 FOR_EACH_OBSERVER(Observer, observer_list_, 1584 FOR_EACH_OBSERVER(Observer, observer_list_,
1584 OnResponseCompleted(this, request)); 1585 OnResponseCompleted(this, request));
1585 } 1586 }
1586 1587
1587 void ResourceDispatcherHost::NotifyReceivedRedirect(net::URLRequest* request, 1588 void ResourceDispatcherHost::NotifyReceivedRedirect(net::URLRequest* request,
1588 int child_id, 1589 int child_id,
1589 const GURL& new_url) { 1590 const GURL& new_url) {
1590 // Notify the observers on the IO thread. 1591 // Notify the observers on the IO thread.
1591 FOR_EACH_OBSERVER(Observer, observer_list_, 1592 FOR_EACH_OBSERVER(Observer, observer_list_,
1592 OnReceivedRedirect(this, request, new_url)); 1593 OnReceivedRedirect(this, request, new_url));
1593 1594
1594 int render_process_id, render_view_id; 1595 // Notify the observers on the UI thread.
1595 if (!RenderViewForRequest(request, &render_process_id, &render_view_id)) 1596 ResourceRedirectDetails* detail = new ResourceRedirectDetails(
1596 return; 1597 request, GetCertID(request, child_id), new_url);
1598 BrowserThread::PostTask(
1599 BrowserThread::UI, FROM_HERE,
1600 NewRunnableFunction(
1601 &ResourceDispatcherHost::NotifyOnUI<ResourceRedirectDetails>,
1602 NotificationType::RESOURCE_RECEIVED_REDIRECT,
1603 detail));
1604 }
1597 1605
1598 // Notify the observers on the UI thread. 1606 template <class T>
1599 CallRenderViewHostResourceDelegate( 1607 void ResourceDispatcherHost::NotifyOnUI(NotificationType type, T* detail) {
1600 render_process_id, render_view_id, 1608 NotificationService::current()->Notify(
1601 &RenderViewHostDelegate::Resource::DidRedirectResource, 1609 type, NotificationService::AllSources(), Details<T>(detail));
brettw 2010/12/29 20:20:34 The documentation on the Source for the notificati
jam 2010/12/29 21:52:47 i was on the fence about this, but you convinced m
brettw 2010/12/29 22:19:19 The problem with this solution is that renderer_ho
jam 2010/12/29 23:39:46 ah, got it. done
1602 ResourceRedirectDetails(request, GetCertID(request, child_id), new_url)); 1610 delete detail;
1603 } 1611 }
1604 1612
1605 namespace { 1613 namespace {
1606 1614
1607 // This function attempts to return the "more interesting" load state of |a| 1615 // This function attempts to return the "more interesting" load state of |a|
1608 // and |b|. We don't have temporal information about these load states 1616 // and |b|. We don't have temporal information about these load states
1609 // (meaning we don't know when we transitioned into these states), so we just 1617 // (meaning we don't know when we transitioned into these states), so we just
1610 // rank them according to how "interesting" the states are. 1618 // rank them according to how "interesting" the states are.
1611 // 1619 //
1612 // We take advantage of the fact that the load states are an enumeration listed 1620 // We take advantage of the fact that the load states are an enumeration listed
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1889 return is_prefetch_enabled_; 1897 return is_prefetch_enabled_;
1890 } 1898 }
1891 1899
1892 // static 1900 // static
1893 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) { 1901 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) {
1894 is_prefetch_enabled_ = value; 1902 is_prefetch_enabled_ = value;
1895 } 1903 }
1896 1904
1897 // static 1905 // static
1898 bool ResourceDispatcherHost::is_prefetch_enabled_ = false; 1906 bool ResourceDispatcherHost::is_prefetch_enabled_ = false;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698