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

Side by Side Diff: chrome/browser/page_load_metrics/metrics_web_contents_observer.cc

Issue 2354583003: Destroy observers eagerly when StopTracking is called. (Closed)
Patch Set: Created 4 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
« no previous file with comments | « no previous file | 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/page_load_metrics/metrics_web_contents_observer.h" 5 #include "chrome/browser/page_load_metrics/metrics_web_contents_observer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <ostream> 8 #include <ostream>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 void PageLoadTracker::OnLoadedSubresource(bool was_cached) { 520 void PageLoadTracker::OnLoadedSubresource(bool was_cached) {
521 if (was_cached) { 521 if (was_cached) {
522 ++num_cache_requests_; 522 ++num_cache_requests_;
523 } else { 523 } else {
524 ++num_network_requests_; 524 ++num_network_requests_;
525 } 525 }
526 } 526 }
527 527
528 void PageLoadTracker::StopTracking() { 528 void PageLoadTracker::StopTracking() {
529 did_stop_tracking_ = true; 529 did_stop_tracking_ = true;
530 observers_.clear();
530 } 531 }
531 532
532 void PageLoadTracker::AddObserver( 533 void PageLoadTracker::AddObserver(
533 std::unique_ptr<PageLoadMetricsObserver> observer) { 534 std::unique_ptr<PageLoadMetricsObserver> observer) {
534 observers_.push_back(std::move(observer)); 535 observers_.push_back(std::move(observer));
535 } 536 }
536 537
537 void PageLoadTracker::ClampBrowserTimestampIfInterProcessTimeTickSkew( 538 void PageLoadTracker::ClampBrowserTimestampIfInterProcessTimeTickSkew(
538 base::TimeTicks* event_time) { 539 base::TimeTicks* event_time) {
539 DCHECK(event_time != nullptr); 540 DCHECK(event_time != nullptr);
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 content::NavigationHandle* navigation_handle) const { 1067 content::NavigationHandle* navigation_handle) const {
1067 DCHECK(navigation_handle->IsInMainFrame()); 1068 DCHECK(navigation_handle->IsInMainFrame());
1068 DCHECK(!navigation_handle->HasCommitted() || 1069 DCHECK(!navigation_handle->HasCommitted() ||
1069 !navigation_handle->IsSamePage()); 1070 !navigation_handle->IsSamePage());
1070 1071
1071 return BrowserPageTrackDecider(embedder_interface_.get(), web_contents(), 1072 return BrowserPageTrackDecider(embedder_interface_.get(), web_contents(),
1072 navigation_handle).ShouldTrack(); 1073 navigation_handle).ShouldTrack();
1073 } 1074 }
1074 1075
1075 } // namespace page_load_metrics 1076 } // namespace page_load_metrics
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698