| OLD | NEW |
| 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/process_resource_usage.h" | 5 #include "chrome/browser/process_resource_usage.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 13 #include "base/thread_task_runner_handle.h" | 13 #include "base/threading/thread_task_runner_handle.h" |
| 14 #include "chrome/common/resource_usage_reporter_type_converters.h" | 14 #include "chrome/common/resource_usage_reporter_type_converters.h" |
| 15 | 15 |
| 16 ProcessResourceUsage::ProcessResourceUsage( | 16 ProcessResourceUsage::ProcessResourceUsage( |
| 17 mojom::ResourceUsageReporterPtr service) | 17 mojom::ResourceUsageReporterPtr service) |
| 18 : service_(std::move(service)), update_in_progress_(false) { | 18 : service_(std::move(service)), update_in_progress_(false) { |
| 19 service_.set_connection_error_handler( | 19 service_.set_connection_error_handler( |
| 20 base::Bind(&ProcessResourceUsage::RunPendingRefreshCallbacks, | 20 base::Bind(&ProcessResourceUsage::RunPendingRefreshCallbacks, |
| 21 base::Unretained(this))); | 21 base::Unretained(this))); |
| 22 } | 22 } |
| 23 | 23 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 return 0; | 79 return 0; |
| 80 } | 80 } |
| 81 | 81 |
| 82 blink::WebCache::ResourceTypeStats ProcessResourceUsage::GetWebCoreCacheStats() | 82 blink::WebCache::ResourceTypeStats ProcessResourceUsage::GetWebCoreCacheStats() |
| 83 const { | 83 const { |
| 84 DCHECK(thread_checker_.CalledOnValidThread()); | 84 DCHECK(thread_checker_.CalledOnValidThread()); |
| 85 if (stats_ && stats_->web_cache_stats) | 85 if (stats_ && stats_->web_cache_stats) |
| 86 return stats_->web_cache_stats->To<blink::WebCache::ResourceTypeStats>(); | 86 return stats_->web_cache_stats->To<blink::WebCache::ResourceTypeStats>(); |
| 87 return {}; | 87 return {}; |
| 88 } | 88 } |
| OLD | NEW |