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

Side by Side Diff: chrome/browser/tab_contents/tab_contents.cc

Issue 6263014: Add Perceived PageLoad Time (PPLT) metrics for Prerender Experiments,... (Closed) Base URL: svn://svn.chromium.org/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
« no previous file with comments | « chrome/browser/tab_contents/tab_contents.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/tab_contents/tab_contents.h" 5 #include "chrome/browser/tab_contents/tab_contents.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 autofill_manager_(), 368 autofill_manager_(),
369 plugin_installer_(), 369 plugin_installer_(),
370 bookmark_drag_(NULL), 370 bookmark_drag_(NULL),
371 ALLOW_THIS_IN_INITIALIZER_LIST(fav_icon_helper_(this)), 371 ALLOW_THIS_IN_INITIALIZER_LIST(fav_icon_helper_(this)),
372 is_loading_(false), 372 is_loading_(false),
373 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING), 373 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING),
374 crashed_error_code_(0), 374 crashed_error_code_(0),
375 waiting_for_response_(false), 375 waiting_for_response_(false),
376 max_page_id_(-1), 376 max_page_id_(-1),
377 current_load_start_(), 377 current_load_start_(),
378 pplt_load_start_(),
378 load_state_(net::LOAD_STATE_IDLE), 379 load_state_(net::LOAD_STATE_IDLE),
379 load_state_host_(), 380 load_state_host_(),
380 upload_size_(0), 381 upload_size_(0),
381 upload_position_(0), 382 upload_position_(0),
382 received_page_title_(false), 383 received_page_title_(false),
383 is_starred_(false), 384 is_starred_(false),
384 contents_mime_type_(), 385 contents_mime_type_(),
385 encoding_(), 386 encoding_(),
386 blocked_contents_(NULL), 387 blocked_contents_(NULL),
387 all_contents_blocked_(false), 388 all_contents_blocked_(false),
(...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1647 1648
1648 ProvisionalLoadDetails details( 1649 ProvisionalLoadDetails details(
1649 is_main_frame, 1650 is_main_frame,
1650 controller_.IsURLInPageNavigation(validated_url), 1651 controller_.IsURLInPageNavigation(validated_url),
1651 validated_url, std::string(), false, is_error_page, frame_id); 1652 validated_url, std::string(), false, is_error_page, frame_id);
1652 NotificationService::current()->Notify( 1653 NotificationService::current()->Notify(
1653 NotificationType::FRAME_PROVISIONAL_LOAD_START, 1654 NotificationType::FRAME_PROVISIONAL_LOAD_START,
1654 Source<NavigationController>(&controller_), 1655 Source<NavigationController>(&controller_),
1655 Details<ProvisionalLoadDetails>(&details)); 1656 Details<ProvisionalLoadDetails>(&details));
1656 if (is_main_frame) { 1657 if (is_main_frame) {
1658 // Record the beginning of a new PPLT navigation.
brettw 2011/01/26 20:16:47 I realized how we can do this just in your compone
1659 pplt_load_start_ = base::TimeTicks::Now();
1660
1657 // If we're displaying a network error page do not reset the content 1661 // If we're displaying a network error page do not reset the content
1658 // settings delegate's cookies so the user has a chance to modify cookie 1662 // settings delegate's cookies so the user has a chance to modify cookie
1659 // settings. 1663 // settings.
1660 if (!is_error_page) 1664 if (!is_error_page)
1661 content_settings_delegate_->ClearCookieSpecificContentSettings(); 1665 content_settings_delegate_->ClearCookieSpecificContentSettings();
1662 content_settings_delegate_->ClearGeolocationContentSettings(); 1666 content_settings_delegate_->ClearGeolocationContentSettings();
1663 1667
1664 // Check if the URL we are about to load has been prerendered by any chance, 1668 // Check if the URL we are about to load has been prerendered by any chance,
1665 // and use it if possible. 1669 // and use it if possible.
1666 MaybeUsePreloadedPage(url); 1670 MaybeUsePreloadedPage(url);
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after
2807 details.reset(new LoadNotificationDetails( 2811 details.reset(new LoadNotificationDetails(
2808 entry->virtual_url(), 2812 entry->virtual_url(),
2809 entry->transition_type(), 2813 entry->transition_type(),
2810 elapsed, 2814 elapsed,
2811 &controller_, 2815 &controller_,
2812 controller_.GetCurrentEntryIndex())); 2816 controller_.GetCurrentEntryIndex()));
2813 } 2817 }
2814 2818
2815 SetIsLoading(false, details.get()); 2819 SetIsLoading(false, details.get());
2816 2820
2821 // Compute the PPLT metric and report it in a histogram, if needed.
2822 PrerenderManager* pm = profile()->GetPrerenderManager();
2823 if (pm != NULL && !pplt_load_start_.is_null())
2824 pm->RecordPerceivedPageLoadTime(base::TimeTicks::Now() - pplt_load_start_);
2825
2826 // Reset the PPLT metric.
2827 pplt_load_start_ = base::TimeTicks();
2828
2817 // Notify observers about navigation. 2829 // Notify observers about navigation.
2818 FOR_EACH_OBSERVER(WebNavigationObserver, web_navigation_observers_, 2830 FOR_EACH_OBSERVER(WebNavigationObserver, web_navigation_observers_,
2819 DidStopLoading()); 2831 DidStopLoading());
2820 } 2832 }
2821 2833
2822 void TabContents::DidChangeLoadProgress(double progress) { 2834 void TabContents::DidChangeLoadProgress(double progress) {
2823 if (delegate()) 2835 if (delegate())
2824 delegate()->LoadProgressChanged(progress); 2836 delegate()->LoadProgressChanged(progress);
2825 } 2837 }
2826 2838
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
3386 } 3398 }
3387 3399
3388 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { 3400 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) {
3389 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); 3401 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh);
3390 rwh_view->SetSize(view()->GetContainerSize()); 3402 rwh_view->SetSize(view()->GetContainerSize());
3391 } 3403 }
3392 3404
3393 bool TabContents::MaybeUsePreloadedPage(const GURL& url) { 3405 bool TabContents::MaybeUsePreloadedPage(const GURL& url) {
3394 PrerenderManager* pm = profile()->GetPrerenderManager(); 3406 PrerenderManager* pm = profile()->GetPrerenderManager();
3395 if (pm != NULL) { 3407 if (pm != NULL) {
3396 if (pm->MaybeUsePreloadedPage(this, url)) { 3408 if (pm->MaybeUsePreloadedPage(this, url))
3397 // TODO(tburkard): If the preloaded page has not finished preloading
3398 // yet, we should not do this.
3399 DidStopLoading();
3400 return true; 3409 return true;
3401 }
3402 } 3410 }
3403 return false; 3411 return false;
3404 } 3412 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/tab_contents.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698