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

Side by Side Diff: chrome/browser/data_use_measurement/chrome_data_use_ascriber_service.cc

Issue 2413663003: Expose GlobalRequestID in NavigationHandle and ResourceRequestInfo. (Closed)
Patch Set: Add comments. Relocate method. Created 4 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/data_use_measurement/chrome_data_use_ascriber_service.h " 5 #include "chrome/browser/data_use_measurement/chrome_data_use_ascriber_service.h "
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/data_use_measurement/chrome_data_use_ascriber.h" 10 #include "chrome/browser/data_use_measurement/chrome_data_use_ascriber.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // While remove() is a O(n) operation, the pending queue is not expected 148 // While remove() is a O(n) operation, the pending queue is not expected
149 // to have a significant number of elements. 149 // to have a significant number of elements.
150 DCHECK_GE(50u, pending_navigations_queue_.size()); 150 DCHECK_GE(50u, pending_navigations_queue_.size());
151 pending_navigations_queue_.remove(navigation_handle); 151 pending_navigations_queue_.remove(navigation_handle);
152 return; 152 return;
153 } 153 }
154 154
155 if (!ascriber_) 155 if (!ascriber_)
156 return; 156 return;
157 157
158 // In this case, is_success() will be false for the the main frame URLRequest
159 // and the pending navigation entry will be removed when URLRequest completes.
160 if (!navigation_handle->HasNetworkResponseStarted())
161 return;
162
158 content::WebContents* web_contents = navigation_handle->GetWebContents(); 163 content::WebContents* web_contents = navigation_handle->GetWebContents();
159 content::BrowserThread::PostTask( 164 content::BrowserThread::PostTask(
160 content::BrowserThread::IO, FROM_HERE, 165 content::BrowserThread::IO, FROM_HERE,
161 base::Bind( 166 base::Bind(
162 &ChromeDataUseAscriber::DidFinishMainFrameNavigation, 167 &ChromeDataUseAscriber::DidFinishMainFrameNavigation,
163 base::Unretained(ascriber_), navigation_handle->GetURL(), 168 base::Unretained(ascriber_), navigation_handle->GetURL(),
169 navigation_handle->GetGlobalRequestID(),
164 web_contents->GetRenderProcessHost()->GetID(), 170 web_contents->GetRenderProcessHost()->GetID(),
165 web_contents->GetMainFrame()->GetRoutingID(), 171 web_contents->GetMainFrame()->GetRoutingID(),
166 !navigation_handle->HasCommitted() || navigation_handle->IsSamePage(), 172 !navigation_handle->HasCommitted() || navigation_handle->IsSamePage(),
167 navigation_handle)); 173 navigation_handle));
168 } 174 }
169 175
170 void ChromeDataUseAscriberService::DidRedirectNavigation( 176 void ChromeDataUseAscriberService::DidRedirectNavigation(
171 content::NavigationHandle* navigation_handle) { 177 content::NavigationHandle* navigation_handle) {
172 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 178 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
173 179
(...skipping 26 matching lines...) Expand all
200 } 206 }
201 pending_frames_queue_.clear(); 207 pending_frames_queue_.clear();
202 208
203 for (auto& it : pending_navigations_queue_) { 209 for (auto& it : pending_navigations_queue_) {
204 DidStartNavigation(it); 210 DidStartNavigation(it);
205 } 211 }
206 pending_navigations_queue_.clear(); 212 pending_navigations_queue_.clear();
207 } 213 }
208 214
209 } // namespace data_use_measurement 215 } // namespace data_use_measurement
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698