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

Side by Side Diff: chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.h

Issue 10823169: Another attempt at fixing dead frames being tracked by webNavigation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 8 years, 4 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_RENDERER_HOST_CHROME_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ 5 #ifndef CHROME_BROWSER_RENDERER_HOST_CHROME_RESOURCE_DISPATCHER_HOST_DELEGATE_H_
6 #define CHROME_BROWSER_RENDERER_HOST_CHROME_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ 6 #define CHROME_BROWSER_RENDERER_HOST_CHROME_RESOURCE_DISPATCHER_HOST_DELEGATE_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/metrics/field_trial.h" 12 #include "base/metrics/field_trial.h"
13 #include "chrome/common/metrics/variation_ids.h" 13 #include "chrome/common/metrics/variation_ids.h"
14 #include "content/public/browser/resource_dispatcher_host_delegate.h" 14 #include "content/public/browser/resource_dispatcher_host_delegate.h"
15 15
16 class DelayedResourceQueue; 16 class DelayedResourceQueue;
17 class DownloadRequestLimiter; 17 class DownloadRequestLimiter;
18 class SafeBrowsingService; 18 class SafeBrowsingService;
19 class TestNavigationListener;
19 20
20 namespace extensions { 21 namespace extensions {
21 class UserScriptListener; 22 class UserScriptListener;
22 } 23 }
23 24
24 namespace prerender { 25 namespace prerender {
25 class PrerenderTracker; 26 class PrerenderTracker;
26 } 27 }
27 28
28 // Implements ResourceDispatcherHostDelegate. Currently used by the Prerender 29 // Implements ResourceDispatcherHostDelegate. Currently used by the Prerender
29 // system to abort requests and add to the load flags when a request begins. 30 // system to abort requests and add to the load flags when a request begins.
30 class ChromeResourceDispatcherHostDelegate 31 class ChromeResourceDispatcherHostDelegate
31 : public content::ResourceDispatcherHostDelegate, 32 : public content::ResourceDispatcherHostDelegate,
32 public base::FieldTrialList::Observer { 33 public base::FieldTrialList::Observer {
33 public: 34 public:
34 // This class does not take ownership of the tracker but merely holds a 35 // This class does not take ownership of the tracker but merely holds a
35 // reference to it to avoid accessing g_browser_process. 36 // reference to it to avoid accessing g_browser_process.
36 // |prerender_tracker| must outlive |this|. 37 // |prerender_tracker| must outlive |this|.
37 explicit ChromeResourceDispatcherHostDelegate( 38 explicit ChromeResourceDispatcherHostDelegate(
38 prerender::PrerenderTracker* prerender_tracker); 39 prerender::PrerenderTracker* prerender_tracker);
39 virtual ~ChromeResourceDispatcherHostDelegate(); 40 virtual ~ChromeResourceDispatcherHostDelegate();
40 41
42 // Use the |test_navigation_listener| to create additional resource throttles.
43 void SetTestNavigationListener(
44 TestNavigationListener* test_navigation_listener);
45
41 // ResourceDispatcherHostDelegate implementation. 46 // ResourceDispatcherHostDelegate implementation.
42 virtual bool ShouldBeginRequest( 47 virtual bool ShouldBeginRequest(
43 int child_id, 48 int child_id,
44 int route_id, 49 int route_id,
45 const std::string& method, 50 const std::string& method,
46 const GURL& url, 51 const GURL& url,
47 ResourceType::Type resource_type, 52 ResourceType::Type resource_type,
48 content::ResourceContext* resource_context, 53 content::ResourceContext* resource_context,
49 const content::Referrer& referrer) OVERRIDE; 54 const content::Referrer& referrer) OVERRIDE;
50 virtual void RequestBeginning( 55 virtual void RequestBeginning(
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // This method also registers the caller with the FieldTrialList to receive 119 // This method also registers the caller with the FieldTrialList to receive
115 // new variation IDs. 120 // new variation IDs.
116 void InitVariationIDsCacheIfNeeded(); 121 void InitVariationIDsCacheIfNeeded();
117 122
118 // Takes whatever is currently in |variation_ids_set_| and recreates 123 // Takes whatever is currently in |variation_ids_set_| and recreates
119 // |variation_ids_header_| with it. 124 // |variation_ids_header_| with it.
120 void UpdateVariationIDsHeaderValue(); 125 void UpdateVariationIDsHeaderValue();
121 126
122 scoped_refptr<DownloadRequestLimiter> download_request_limiter_; 127 scoped_refptr<DownloadRequestLimiter> download_request_limiter_;
123 scoped_refptr<SafeBrowsingService> safe_browsing_; 128 scoped_refptr<SafeBrowsingService> safe_browsing_;
129 scoped_refptr<TestNavigationListener> test_navigation_listener_;
124 scoped_refptr<extensions::UserScriptListener> user_script_listener_; 130 scoped_refptr<extensions::UserScriptListener> user_script_listener_;
125 prerender::PrerenderTracker* prerender_tracker_; 131 prerender::PrerenderTracker* prerender_tracker_;
126 132
127 // Whether or not we've initialized the Cache. 133 // Whether or not we've initialized the Cache.
128 bool variation_ids_cache_initialized_; 134 bool variation_ids_cache_initialized_;
129 135
130 // Keep a cache of variation IDs that are transmitted in headers to Google. 136 // Keep a cache of variation IDs that are transmitted in headers to Google.
131 // This consists of a list of valid IDs, and the actual transmitted header. 137 // This consists of a list of valid IDs, and the actual transmitted header.
132 // Note that since this cache is both initialized and accessed from the IO 138 // Note that since this cache is both initialized and accessed from the IO
133 // thread, we do not need to synchronize its uses. 139 // thread, we do not need to synchronize its uses.
134 std::set<chrome_variations::VariationID> variation_ids_set_; 140 std::set<chrome_variations::VariationID> variation_ids_set_;
135 std::string variation_ids_header_; 141 std::string variation_ids_header_;
136 142
137 DISALLOW_COPY_AND_ASSIGN(ChromeResourceDispatcherHostDelegate); 143 DISALLOW_COPY_AND_ASSIGN(ChromeResourceDispatcherHostDelegate);
138 }; 144 };
139 145
140 #endif // CHROME_BROWSER_RENDERER_HOST_CHROME_RESOURCE_DISPATCHER_HOST_DELEGATE _H_ 146 #endif // CHROME_BROWSER_RENDERER_HOST_CHROME_RESOURCE_DISPATCHER_HOST_DELEGATE _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698