| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/plugin_metrics_provider.h" | 5 #include "chrome/browser/metrics/plugin_metrics_provider.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 const base::Closure& done_callback, | 327 const base::Closure& done_callback, |
| 328 const std::vector<content::WebPluginInfo>& plugins) { | 328 const std::vector<content::WebPluginInfo>& plugins) { |
| 329 plugins_ = plugins; | 329 plugins_ = plugins; |
| 330 done_callback.Run(); | 330 done_callback.Run(); |
| 331 } | 331 } |
| 332 | 332 |
| 333 PluginMetricsProvider::ChildProcessStats& | 333 PluginMetricsProvider::ChildProcessStats& |
| 334 PluginMetricsProvider::GetChildProcessStats( | 334 PluginMetricsProvider::GetChildProcessStats( |
| 335 const content::ChildProcessData& data) { | 335 const content::ChildProcessData& data) { |
| 336 const base::string16& child_name = data.name; | 336 const base::string16& child_name = data.name; |
| 337 if (!ContainsKey(child_process_stats_buffer_, child_name)) { | 337 if (!base::ContainsKey(child_process_stats_buffer_, child_name)) { |
| 338 child_process_stats_buffer_[child_name] = | 338 child_process_stats_buffer_[child_name] = |
| 339 ChildProcessStats(data.process_type); | 339 ChildProcessStats(data.process_type); |
| 340 } | 340 } |
| 341 return child_process_stats_buffer_[child_name]; | 341 return child_process_stats_buffer_[child_name]; |
| 342 } | 342 } |
| 343 | 343 |
| 344 void PluginMetricsProvider::BrowserChildProcessHostConnected( | 344 void PluginMetricsProvider::BrowserChildProcessHostConnected( |
| 345 const content::ChildProcessData& data) { | 345 const content::ChildProcessData& data) { |
| 346 GetChildProcessStats(data).process_launches++; | 346 GetChildProcessStats(data).process_launches++; |
| 347 RecordCurrentStateWithDelay(kRecordStateDelayMs); | 347 RecordCurrentStateWithDelay(kRecordStateDelayMs); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 377 } | 377 } |
| 378 | 378 |
| 379 bool PluginMetricsProvider::RecordCurrentStateIfPending() { | 379 bool PluginMetricsProvider::RecordCurrentStateIfPending() { |
| 380 if (!weak_ptr_factory_.HasWeakPtrs()) | 380 if (!weak_ptr_factory_.HasWeakPtrs()) |
| 381 return false; | 381 return false; |
| 382 | 382 |
| 383 weak_ptr_factory_.InvalidateWeakPtrs(); | 383 weak_ptr_factory_.InvalidateWeakPtrs(); |
| 384 RecordCurrentState(); | 384 RecordCurrentState(); |
| 385 return true; | 385 return true; |
| 386 } | 386 } |
| OLD | NEW |