OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/metrics/tracking_synchronizer.h" | 5 #include "chrome/browser/metrics/tracking_synchronizer.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
11 #include "base/tracked_objects.h" | 11 #include "base/tracked_objects.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 } | 194 } |
195 | 195 |
196 int sequence_number = current_synchronizer->RegisterAndNotifyAllProcesses( | 196 int sequence_number = current_synchronizer->RegisterAndNotifyAllProcesses( |
197 callback_object); | 197 callback_object); |
198 | 198 |
199 // Post a task that would be called after waiting for wait_time. This acts | 199 // Post a task that would be called after waiting for wait_time. This acts |
200 // as a watchdog, to cancel the requests for non-responsive processes. | 200 // as a watchdog, to cancel the requests for non-responsive processes. |
201 BrowserThread::PostDelayedTask( | 201 BrowserThread::PostDelayedTask( |
202 BrowserThread::UI, FROM_HERE, | 202 BrowserThread::UI, FROM_HERE, |
203 base::Bind(&RequestContext::Unregister, sequence_number), | 203 base::Bind(&RequestContext::Unregister, sequence_number), |
204 base::TimeDelta::FromMinutes(1)); | 204 60000); |
205 } | 205 } |
206 | 206 |
207 void TrackingSynchronizer::OnPendingProcesses(int sequence_number, | 207 void TrackingSynchronizer::OnPendingProcesses(int sequence_number, |
208 int pending_processes, | 208 int pending_processes, |
209 bool end) { | 209 bool end) { |
210 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 210 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
211 | 211 |
212 RequestContext* request = RequestContext::GetRequestContext(sequence_number); | 212 RequestContext* request = RequestContext::GetRequestContext(sequence_number); |
213 if (!request) | 213 if (!request) |
214 return; | 214 return; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 294 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
295 DCHECK(tracking_synchronizer_ != NULL); | 295 DCHECK(tracking_synchronizer_ != NULL); |
296 return tracking_synchronizer_; | 296 return tracking_synchronizer_; |
297 } | 297 } |
298 | 298 |
299 // static | 299 // static |
300 base::LazyInstance<RequestContext::RequestContextMap> | 300 base::LazyInstance<RequestContext::RequestContextMap> |
301 RequestContext::outstanding_requests_ = LAZY_INSTANCE_INITIALIZER; | 301 RequestContext::outstanding_requests_ = LAZY_INSTANCE_INITIALIZER; |
302 | 302 |
303 } // namespace chrome_browser_metrics | 303 } // namespace chrome_browser_metrics |
OLD | NEW |