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

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

Issue 8498039: Revert 109719 - 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);
354 353
355 // Don't override final_status_ if it's FINAL_STATUS_CONTROL_GROUP or 354 // Don't override final_status_ if it's FINAL_STATUS_CONTROL_GROUP,
356 // FINAL_STATUS_MATCH_COMPLETE_DUMMY, otherwise data will be collected 355 // otherwise data will be collected in the Prerender.FinalStatus histogram.
357 // in the Prerender.FinalStatus histogram. 356 if (final_status_ == FINAL_STATUS_CONTROL_GROUP)
358 if (final_status_ == FINAL_STATUS_CONTROL_GROUP ||
359 final_status_ == FINAL_STATUS_MATCH_COMPLETE_DUMMY)
360 return; 357 return;
361 358
362 final_status_ = final_status; 359 final_status_ = final_status;
363 } 360 }
364 361
365 PrerenderContents::~PrerenderContents() { 362 PrerenderContents::~PrerenderContents() {
366 DCHECK(final_status_ != FINAL_STATUS_MAX); 363 DCHECK(final_status_ != FINAL_STATUS_MAX);
367 DCHECK(prerendering_has_been_cancelled_ || 364 DCHECK(prerendering_has_been_cancelled_ ||
368 final_status_ == FINAL_STATUS_USED || 365 final_status_ == FINAL_STATUS_USED ||
369 final_status_ == FINAL_STATUS_CONTROL_GROUP || 366 final_status_ == FINAL_STATUS_CONTROL_GROUP);
370 final_status_ == FINAL_STATUS_MATCH_COMPLETE_DUMMY);
371 DCHECK(origin_ != ORIGIN_MAX); 367 DCHECK(origin_ != ORIGIN_MAX);
372 368
373 // If we haven't even started prerendering, we were just in the control 369 // If we haven't even started prerendering, we were just in the control
374 // group (or a match complete dummy), which means we do not want to record 370 // group, which means we do not want to record the status.
375 // the status.
376 if (prerendering_has_started()) 371 if (prerendering_has_started())
377 prerender_manager_->RecordFinalStatus(origin_, experiment_id_, 372 prerender_manager_->RecordFinalStatus(origin_, experiment_id_,
378 final_status_); 373 final_status_);
379 374
380 if (child_id_ != -1 && route_id_ != -1) 375 if (child_id_ != -1 && route_id_ != -1)
381 prerender_tracker_->OnPrerenderingFinished(child_id_, route_id_); 376 prerender_tracker_->OnPrerenderingFinished(child_id_, route_id_);
382 377
383 // If we still have a TabContents, clean up anything we need to and then 378 // If we still have a TabContents, clean up anything we need to and then
384 // destroy it. 379 // destroy it.
385 if (prerender_contents_.get()) 380 if (prerender_contents_.get())
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 if (!prerender_tracker_->GetFinalStatus(child_id_, route_id_, 572 if (!prerender_tracker_->GetFinalStatus(child_id_, route_id_,
578 &final_status)) { 573 &final_status)) {
579 NOTREACHED(); 574 NOTREACHED();
580 } 575 }
581 } 576 }
582 set_final_status(final_status); 577 set_final_status(final_status);
583 578
584 prerendering_has_been_cancelled_ = true; 579 prerendering_has_been_cancelled_ = true;
585 // This has to be done after setting the final status, as it adds the 580 // This has to be done after setting the final status, as it adds the
586 // prerender to the history. 581 // prerender to the history.
587 prerender_manager_->MoveEntryToPendingDelete(this, final_status); 582 prerender_manager_->MoveEntryToPendingDelete(this);
588 583
589 // We may destroy the PrerenderContents before we have initialized the 584 // We may destroy the PrerenderContents before we have initialized the
590 // RenderViewHost. Otherwise set the Observer's PrerenderContents to NULL to 585 // RenderViewHost. Otherwise set the Observer's PrerenderContents to NULL to
591 // avoid any more messages being sent. 586 // avoid any more messages being sent.
592 if (render_view_host_observer_.get()) 587 if (render_view_host_observer_.get())
593 render_view_host_observer_->set_prerender_contents(NULL); 588 render_view_host_observer_->set_prerender_contents(NULL);
594 } 589 }
595 590
596 base::ProcessMetrics* PrerenderContents::MaybeGetProcessMetrics() { 591 base::ProcessMetrics* PrerenderContents::MaybeGetProcessMetrics() {
597 if (process_metrics_.get() == NULL) { 592 if (process_metrics_.get() == NULL) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 bool PrerenderContents::IsCrossSiteNavigationPending() const { 662 bool PrerenderContents::IsCrossSiteNavigationPending() const {
668 if (!prerender_contents_.get() || !prerender_contents_->tab_contents()) 663 if (!prerender_contents_.get() || !prerender_contents_->tab_contents())
669 return false; 664 return false;
670 const TabContents* tab_contents = prerender_contents_->tab_contents(); 665 const TabContents* tab_contents = prerender_contents_->tab_contents();
671 return (tab_contents->GetSiteInstance() != 666 return (tab_contents->GetSiteInstance() !=
672 tab_contents->GetPendingSiteInstance()); 667 tab_contents->GetPendingSiteInstance());
673 } 668 }
674 669
675 670
676 } // namespace prerender 671 } // namespace prerender
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_contents.h ('k') | chrome/browser/prerender/prerender_final_status.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698