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

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

Issue 2334613003: Re-write many calls to WrapUnique() with MakeUnique() (Closed)
Patch Set: Changes from review by sky 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
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 765 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 // We can have two provisional loads in some cases. E.g. a same-site 776 // We can have two provisional loads in some cases. E.g. a same-site
777 // navigation can have a concurrent cross-process navigation started 777 // navigation can have a concurrent cross-process navigation started
778 // from the omnibox. 778 // from the omnibox.
779 DCHECK_GT(2ul, provisional_loads_.size()); 779 DCHECK_GT(2ul, provisional_loads_.size());
780 // Passing raw pointers to observers_ and embedder_interface_ is safe because 780 // Passing raw pointers to observers_ and embedder_interface_ is safe because
781 // the MetricsWebContentsObserver owns them both list and they are torn down 781 // the MetricsWebContentsObserver owns them both list and they are torn down
782 // after the PageLoadTracker. The PageLoadTracker does not hold on to 782 // after the PageLoadTracker. The PageLoadTracker does not hold on to
783 // committed_load_ or navigation_handle beyond the scope of the constructor. 783 // committed_load_ or navigation_handle beyond the scope of the constructor.
784 provisional_loads_.insert(std::make_pair( 784 provisional_loads_.insert(std::make_pair(
785 navigation_handle, 785 navigation_handle,
786 base::WrapUnique(new PageLoadTracker( 786 base::MakeUnique<PageLoadTracker>(
787 in_foreground_, embedder_interface_.get(), currently_committed_url, 787 in_foreground_, embedder_interface_.get(), currently_committed_url,
788 navigation_handle, chain_size, chain_size_same_url)))); 788 navigation_handle, chain_size, chain_size_same_url)));
789 } 789 }
790 790
791 void MetricsWebContentsObserver::OnRequestComplete( 791 void MetricsWebContentsObserver::OnRequestComplete(
792 content::ResourceType resource_type, 792 content::ResourceType resource_type,
793 bool was_cached, 793 bool was_cached,
794 int net_error) { 794 int net_error) {
795 // For simplicity, only count subresources. Navigations are hard to attribute 795 // For simplicity, only count subresources. Navigations are hard to attribute
796 // here because we won't have a committed load by the time data streams in 796 // here because we won't have a committed load by the time data streams in
797 // from the IO thread. 797 // from the IO thread.
798 if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME && 798 if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME &&
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 if (navigation_handle->IsSamePage() || navigation_handle->IsErrorPage()) 1069 if (navigation_handle->IsSamePage() || navigation_handle->IsErrorPage())
1070 return false; 1070 return false;
1071 const std::string& mime_type = web_contents()->GetContentsMimeType(); 1071 const std::string& mime_type = web_contents()->GetContentsMimeType();
1072 if (mime_type != "text/html" && mime_type != "application/xhtml+xml") 1072 if (mime_type != "text/html" && mime_type != "application/xhtml+xml")
1073 return false; 1073 return false;
1074 } 1074 }
1075 return true; 1075 return true;
1076 } 1076 }
1077 1077
1078 } // namespace page_load_metrics 1078 } // namespace page_load_metrics
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698