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

Side by Side Diff: chrome/browser/net/load_time_stats.cc

Issue 10914323: Switch LoadTimeStatsTabHelper to use WebContentsUserData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 3 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 #include "chrome/browser/net/load_time_stats.h" 5 #include "chrome/browser/net/load_time_stats.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/timer.h" 10 #include "base/timer.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/io_thread.h" 12 #include "chrome/browser/io_thread.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/tab_contents/tab_contents.h"
15 #include "content/public/browser/browser_thread.h" 14 #include "content/public/browser/browser_thread.h"
16 #include "content/public/browser/render_process_host.h" 15 #include "content/public/browser/render_process_host.h"
17 #include "content/public/browser/render_view_host.h" 16 #include "content/public/browser/render_view_host.h"
18 #include "content/public/browser/resource_request_info.h" 17 #include "content/public/browser/resource_request_info.h"
19 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
20 #include "net/url_request/url_request.h" 19 #include "net/url_request/url_request.h"
21 20
22 using content::BrowserThread; 21 using content::BrowserThread;
23 using content::RenderViewHost; 22 using content::RenderViewHost;
24 using content::ResourceRequestInfo; 23 using content::ResourceRequestInfo;
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 private: 247 private:
249 base::TimeTicks GetCurrentTime() { 248 base::TimeTicks GetCurrentTime() {
250 return base::TimeTicks::Now(); 249 return base::TimeTicks::Now();
251 } 250 }
252 bool done_; 251 bool done_;
253 base::TimeTicks start_time_; 252 base::TimeTicks start_time_;
254 RequestStatus status_; 253 RequestStatus status_;
255 base::TimeDelta status_times_[REQUEST_STATUS_MAX]; 254 base::TimeDelta status_times_[REQUEST_STATUS_MAX];
256 }; 255 };
257 256
258 LoadTimeStatsTabHelper::LoadTimeStatsTabHelper(TabContents* tab) 257 int LoadTimeStatsTabHelper::kUserDataKey;
cbentzel 2012/09/18 13:55:41 Nit: // static comment? Also - would it make sen
Avi (use Gerrit) 2012/09/18 14:11:47 This is an idiom; every WebContentsUserData gets o
259 : content::WebContentsObserver(tab->web_contents()) { 258
260 is_otr_profile_ = tab->profile()->IsOffTheRecord(); 259 LoadTimeStatsTabHelper::LoadTimeStatsTabHelper(
260 content::WebContents* web_contents)
261 : content::WebContentsObserver(web_contents) {
262 is_otr_profile_ = web_contents->GetBrowserContext()->IsOffTheRecord();
261 } 263 }
262 264
263 LoadTimeStatsTabHelper::~LoadTimeStatsTabHelper() { 265 LoadTimeStatsTabHelper::~LoadTimeStatsTabHelper() {
264 } 266 }
265 267
266 void LoadTimeStatsTabHelper::DidStartProvisionalLoadForFrame( 268 void LoadTimeStatsTabHelper::DidStartProvisionalLoadForFrame(
267 int64 frame_id, 269 int64 frame_id,
268 bool is_main_frame, 270 bool is_main_frame,
269 const GURL& validated_url, 271 const GURL& validated_url,
270 bool is_error_page, 272 bool is_error_page,
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 if (type == ChromeURLRequestContext::CONTEXT_TYPE_MAIN) 546 if (type == ChromeURLRequestContext::CONTEXT_TYPE_MAIN)
545 main_request_contexts_.insert(context); 547 main_request_contexts_.insert(context);
546 } 548 }
547 549
548 void LoadTimeStats::UnregisterURLRequestContext( 550 void LoadTimeStats::UnregisterURLRequestContext(
549 const net::URLRequestContext* context) { 551 const net::URLRequestContext* context) {
550 main_request_contexts_.erase(context); 552 main_request_contexts_.erase(context);
551 } 553 }
552 554
553 } // namespace chrome_browser_net 555 } // namespace chrome_browser_net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698