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

Side by Side Diff: chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc

Issue 2916253002: Add UMA to determine how often we offline a page with previews. (Closed)
Patch Set: Histograms fix Created 3 years, 6 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/loader/chrome_resource_dispatcher_host_delegate.h" 5 #include "chrome/browser/loader/chrome_resource_dispatcher_host_delegate.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 #include "content/public/browser/plugin_service_filter.h" 64 #include "content/public/browser/plugin_service_filter.h"
65 #include "content/public/browser/render_frame_host.h" 65 #include "content/public/browser/render_frame_host.h"
66 #include "content/public/browser/render_process_host.h" 66 #include "content/public/browser/render_process_host.h"
67 #include "content/public/browser/render_view_host.h" 67 #include "content/public/browser/render_view_host.h"
68 #include "content/public/browser/resource_context.h" 68 #include "content/public/browser/resource_context.h"
69 #include "content/public/browser/resource_dispatcher_host.h" 69 #include "content/public/browser/resource_dispatcher_host.h"
70 #include "content/public/browser/resource_request_info.h" 70 #include "content/public/browser/resource_request_info.h"
71 #include "content/public/browser/service_worker_context.h" 71 #include "content/public/browser/service_worker_context.h"
72 #include "content/public/browser/stream_info.h" 72 #include "content/public/browser/stream_info.h"
73 #include "content/public/browser/web_contents.h" 73 #include "content/public/browser/web_contents.h"
74 #include "content/public/common/previews_state.h"
74 #include "content/public/common/resource_response.h" 75 #include "content/public/common/resource_response.h"
75 #include "extensions/features/features.h" 76 #include "extensions/features/features.h"
76 #include "net/base/load_flags.h" 77 #include "net/base/load_flags.h"
77 #include "net/base/load_timing_info.h" 78 #include "net/base/load_timing_info.h"
78 #include "net/base/request_priority.h" 79 #include "net/base/request_priority.h"
79 #include "net/http/http_response_headers.h" 80 #include "net/http/http_response_headers.h"
80 #include "net/ssl/client_cert_store.h" 81 #include "net/ssl/client_cert_store.h"
81 #include "net/url_request/url_request.h" 82 #include "net/url_request/url_request.h"
82 #include "third_party/protobuf/src/google/protobuf/repeated_field.h" 83 #include "third_party/protobuf/src/google/protobuf/repeated_field.h"
83 84
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 } 937 }
937 938
938 content::NavigationData* 939 content::NavigationData*
939 ChromeResourceDispatcherHostDelegate::GetNavigationData( 940 ChromeResourceDispatcherHostDelegate::GetNavigationData(
940 net::URLRequest* request) const { 941 net::URLRequest* request) const {
941 ChromeNavigationData* data = 942 ChromeNavigationData* data =
942 ChromeNavigationData::GetDataAndCreateIfNecessary(request); 943 ChromeNavigationData::GetDataAndCreateIfNecessary(request);
943 if (!request) 944 if (!request)
944 return data; 945 return data;
945 946
947 // Update the previews state from the navigation data.
948 const content::ResourceRequestInfo* info =
949 content::ResourceRequestInfo::ForRequest(request);
950 if (info) {
951 data->set_previews_state(info->GetPreviewsState());
952 }
953
946 data_reduction_proxy::DataReductionProxyData* data_reduction_proxy_data = 954 data_reduction_proxy::DataReductionProxyData* data_reduction_proxy_data =
947 data_reduction_proxy::DataReductionProxyData::GetData(*request); 955 data_reduction_proxy::DataReductionProxyData::GetData(*request);
948 // DeepCopy the DataReductionProxyData from the URLRequest to prevent the 956 // DeepCopy the DataReductionProxyData from the URLRequest to prevent the
949 // URLRequest and DataReductionProxyData from both having ownership of the 957 // URLRequest and DataReductionProxyData from both having ownership of the
950 // same object. This copy will be shortlived as it will be deep copied again 958 // same object. This copy will be shortlived as it will be deep copied again
951 // when content makes a clone of NavigationData for the UI thread. 959 // when content makes a clone of NavigationData for the UI thread.
952 if (data_reduction_proxy_data) 960 if (data_reduction_proxy_data)
953 data->SetDataReductionProxyData(data_reduction_proxy_data->DeepCopy()); 961 data->SetDataReductionProxyData(data_reduction_proxy_data->DeepCopy());
954 return data; 962 return data;
955 } 963 }
(...skipping 17 matching lines...) Expand all
973 &ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, 981 &ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad,
974 base::Unretained(this), url, request_loading_time)); 982 base::Unretained(this), url, request_loading_time));
975 return; 983 return;
976 } 984 }
977 985
978 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? 986 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ?
979 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); 987 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow");
980 rappor::SampleDomainAndRegistryFromGURL( 988 rappor::SampleDomainAndRegistryFromGURL(
981 g_browser_process->rappor_service(), metric_name, url); 989 g_browser_process->rappor_service(), metric_name, url);
982 } 990 }
OLDNEW
« no previous file with comments | « chrome/browser/loader/chrome_navigation_data.cc ('k') | chrome/browser/offline_pages/background_loader_offliner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698