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

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

Issue 2888673002: Add support for counting same-document AMP loads. (Closed)
Patch Set: comment cleanup Created 3 years, 7 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
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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 324
325 std::unique_ptr<PageLoadTracker> finished_nav( 325 std::unique_ptr<PageLoadTracker> finished_nav(
326 std::move(provisional_loads_[navigation_handle])); 326 std::move(provisional_loads_[navigation_handle]));
327 provisional_loads_.erase(navigation_handle); 327 provisional_loads_.erase(navigation_handle);
328 328
329 // Ignore same-document navigations. 329 // Ignore same-document navigations.
330 if (navigation_handle->HasCommitted() && 330 if (navigation_handle->HasCommitted() &&
331 navigation_handle->IsSameDocument()) { 331 navigation_handle->IsSameDocument()) {
332 if (finished_nav) 332 if (finished_nav)
333 finished_nav->StopTracking(); 333 finished_nav->StopTracking();
334 if (committed_load_)
335 committed_load_->DidCommitSameDocumentNavigation(navigation_handle);
334 return; 336 return;
335 } 337 }
336 338
337 // Ignore internally generated aborts for navigations with HTTP responses that 339 // Ignore internally generated aborts for navigations with HTTP responses that
338 // don't commit, such as HTTP 204 responses and downloads. 340 // don't commit, such as HTTP 204 responses and downloads.
339 if (!navigation_handle->HasCommitted() && 341 if (!navigation_handle->HasCommitted() &&
340 navigation_handle->GetNetErrorCode() == net::ERR_ABORTED && 342 navigation_handle->GetNetErrorCode() == net::ERR_ABORTED &&
341 navigation_handle->GetResponseHeaders()) { 343 navigation_handle->GetResponseHeaders()) {
342 if (finished_nav) 344 if (finished_nav)
343 finished_nav->StopTracking(); 345 finished_nav->StopTracking();
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 observer_->RemoveTestingObserver(this); 644 observer_->RemoveTestingObserver(this);
643 observer_ = nullptr; 645 observer_ = nullptr;
644 } 646 }
645 } 647 }
646 648
647 void MetricsWebContentsObserver::TestingObserver::OnGoingAway() { 649 void MetricsWebContentsObserver::TestingObserver::OnGoingAway() {
648 observer_ = nullptr; 650 observer_ = nullptr;
649 } 651 }
650 652
651 } // namespace page_load_metrics 653 } // namespace page_load_metrics
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698