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

Side by Side Diff: chrome/browser/prerender/prerender_contents.cc

Issue 8503040: Prerendering: Add MatchComplete PPLT (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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) 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/prerender/prerender_contents.h" 5 #include "chrome/browser/prerender/prerender_contents.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/process_util.h" 10 #include "base/process_util.h"
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 bool PrerenderContents::GetRouteId(int* route_id) const { 342 bool PrerenderContents::GetRouteId(int* route_id) const {
343 CHECK(route_id); 343 CHECK(route_id);
344 DCHECK_GE(route_id_, -1); 344 DCHECK_GE(route_id_, -1);
345 *route_id = route_id_; 345 *route_id = route_id_;
346 return route_id_ != -1; 346 return route_id_ != -1;
347 } 347 }
348 348
349 void PrerenderContents::set_final_status(FinalStatus final_status) { 349 void PrerenderContents::set_final_status(FinalStatus final_status) {
350 DCHECK(final_status >= FINAL_STATUS_USED && final_status < FINAL_STATUS_MAX); 350 DCHECK(final_status >= FINAL_STATUS_USED && final_status < FINAL_STATUS_MAX);
351 DCHECK(final_status_ == FINAL_STATUS_MAX || 351 DCHECK(final_status_ == FINAL_STATUS_MAX ||
352 final_status_ == FINAL_STATUS_CONTROL_GROUP); 352 final_status_ == FINAL_STATUS_CONTROL_GROUP ||
353 final_status_ == FINAL_STATUS_MATCH_COMPLETE_DUMMY);
353 354
354 // Don't override final_status_ if it's FINAL_STATUS_CONTROL_GROUP, 355 // Don't override final_status_ if it's FINAL_STATUS_CONTROL_GROUP,
cbentzel 2011/11/10 13:16:25 Update comment.
tburkard 2011/11/10 18:36:55 Done.
355 // otherwise data will be collected in the Prerender.FinalStatus histogram. 356 // otherwise data will be collected in the Prerender.FinalStatus histogram.
356 if (final_status_ == FINAL_STATUS_CONTROL_GROUP) 357 if (final_status_ == FINAL_STATUS_CONTROL_GROUP ||
358 final_status_ == FINAL_STATUS_MATCH_COMPLETE_DUMMY)
357 return; 359 return;
358 360
359 final_status_ = final_status; 361 final_status_ = final_status;
360 } 362 }
361 363
362 PrerenderContents::~PrerenderContents() { 364 PrerenderContents::~PrerenderContents() {
363 DCHECK(final_status_ != FINAL_STATUS_MAX); 365 DCHECK(final_status_ != FINAL_STATUS_MAX);
364 DCHECK(prerendering_has_been_cancelled_ || 366 DCHECK(prerendering_has_been_cancelled_ ||
cbentzel 2011/11/10 13:16:25 Does this need to be updated with the MATCH_COMPLE
tburkard 2011/11/10 18:36:55 Yes. Excellent catch. Surprised neither my testi
cbentzel 2011/11/10 19:45:29 Yeah - I'm actually a little worried about that. D
365 final_status_ == FINAL_STATUS_USED || 367 final_status_ == FINAL_STATUS_USED ||
366 final_status_ == FINAL_STATUS_CONTROL_GROUP); 368 final_status_ == FINAL_STATUS_CONTROL_GROUP);
367 DCHECK(origin_ != ORIGIN_MAX); 369 DCHECK(origin_ != ORIGIN_MAX);
368 370
369 // If we haven't even started prerendering, we were just in the control 371 // If we haven't even started prerendering, we were just in the control
370 // group, which means we do not want to record the status. 372 // group, which means we do not want to record the status.
371 if (prerendering_has_started()) 373 if (prerendering_has_started())
372 prerender_manager_->RecordFinalStatus(origin_, experiment_id_, 374 prerender_manager_->RecordFinalStatus(origin_, experiment_id_,
373 final_status_); 375 final_status_);
374 376
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 if (!prerender_tracker_->GetFinalStatus(child_id_, route_id_, 574 if (!prerender_tracker_->GetFinalStatus(child_id_, route_id_,
573 &final_status)) { 575 &final_status)) {
574 NOTREACHED(); 576 NOTREACHED();
575 } 577 }
576 } 578 }
577 set_final_status(final_status); 579 set_final_status(final_status);
578 580
579 prerendering_has_been_cancelled_ = true; 581 prerendering_has_been_cancelled_ = true;
580 // This has to be done after setting the final status, as it adds the 582 // This has to be done after setting the final status, as it adds the
581 // prerender to the history. 583 // prerender to the history.
582 prerender_manager_->MoveEntryToPendingDelete(this); 584 prerender_manager_->MoveEntryToPendingDelete(this, final_status);
583 585
584 // We may destroy the PrerenderContents before we have initialized the 586 // We may destroy the PrerenderContents before we have initialized the
585 // RenderViewHost. Otherwise set the Observer's PrerenderContents to NULL to 587 // RenderViewHost. Otherwise set the Observer's PrerenderContents to NULL to
586 // avoid any more messages being sent. 588 // avoid any more messages being sent.
587 if (render_view_host_observer_.get()) 589 if (render_view_host_observer_.get())
588 render_view_host_observer_->set_prerender_contents(NULL); 590 render_view_host_observer_->set_prerender_contents(NULL);
589 } 591 }
590 592
591 base::ProcessMetrics* PrerenderContents::MaybeGetProcessMetrics() { 593 base::ProcessMetrics* PrerenderContents::MaybeGetProcessMetrics() {
592 if (process_metrics_.get() == NULL) { 594 if (process_metrics_.get() == NULL) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 bool PrerenderContents::IsCrossSiteNavigationPending() const { 664 bool PrerenderContents::IsCrossSiteNavigationPending() const {
663 if (!prerender_contents_.get() || !prerender_contents_->tab_contents()) 665 if (!prerender_contents_.get() || !prerender_contents_->tab_contents())
664 return false; 666 return false;
665 const TabContents* tab_contents = prerender_contents_->tab_contents(); 667 const TabContents* tab_contents = prerender_contents_->tab_contents();
666 return (tab_contents->GetSiteInstance() != 668 return (tab_contents->GetSiteInstance() !=
667 tab_contents->GetPendingSiteInstance()); 669 tab_contents->GetPendingSiteInstance());
668 } 670 }
669 671
670 672
671 } // namespace prerender 673 } // namespace prerender
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698