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

Side by Side Diff: chrome/renderer/chrome_render_thread_observer.cc

Issue 2643183002: Convert ChromeViewHostMsg_UpdatedCacheStats to use mojo. (Closed)
Patch Set: Convert ChromeViewHostMsg_UpdatedCacheStats to use mojo. Created 3 years, 10 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
« no previous file with comments | « chrome/common/render_messages.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/renderer/chrome_render_thread_observer.h" 5 #include "chrome/renderer/chrome_render_thread_observer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <memory> 10 #include <memory>
(...skipping 10 matching lines...) Expand all
21 #include "base/memory/weak_ptr.h" 21 #include "base/memory/weak_ptr.h"
22 #include "base/metrics/field_trial.h" 22 #include "base/metrics/field_trial.h"
23 #include "base/metrics/histogram.h" 23 #include "base/metrics/histogram.h"
24 #include "base/metrics/statistics_recorder.h" 24 #include "base/metrics/statistics_recorder.h"
25 #include "base/path_service.h" 25 #include "base/path_service.h"
26 #include "base/single_thread_task_runner.h" 26 #include "base/single_thread_task_runner.h"
27 #include "base/strings/utf_string_conversions.h" 27 #include "base/strings/utf_string_conversions.h"
28 #include "base/threading/platform_thread.h" 28 #include "base/threading/platform_thread.h"
29 #include "base/threading/thread_task_runner_handle.h" 29 #include "base/threading/thread_task_runner_handle.h"
30 #include "build/build_config.h" 30 #include "build/build_config.h"
31 #include "chrome/common/cache_stats_recorder.mojom.h"
31 #include "chrome/common/child_process_logging.h" 32 #include "chrome/common/child_process_logging.h"
32 #include "chrome/common/chrome_paths.h" 33 #include "chrome/common/chrome_paths.h"
33 #include "chrome/common/field_trial_recorder.mojom.h" 34 #include "chrome/common/field_trial_recorder.mojom.h"
34 #include "chrome/common/media/media_resource_provider.h" 35 #include "chrome/common/media/media_resource_provider.h"
35 #include "chrome/common/net/net_resource_provider.h" 36 #include "chrome/common/net/net_resource_provider.h"
36 #include "chrome/common/render_messages.h" 37 #include "chrome/common/render_messages.h"
37 #include "chrome/common/resource_usage_reporter.mojom.h" 38 #include "chrome/common/resource_usage_reporter.mojom.h"
38 #include "chrome/common/resource_usage_reporter_type_converters.h" 39 #include "chrome/common/resource_usage_reporter_type_converters.h"
39 #include "chrome/common/url_constants.h" 40 #include "chrome/common/url_constants.h"
40 #include "chrome/renderer/content_settings_observer.h" 41 #include "chrome/renderer/content_settings_observer.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 std::move(current_peer), RenderThread::Get(), mime_type, url); 111 std::move(current_peer), RenderThread::Get(), mime_type, url);
111 #else 112 #else
112 return current_peer; 113 return current_peer;
113 #endif 114 #endif
114 } 115 }
115 116
116 private: 117 private:
117 void InformHostOfCacheStats() { 118 void InformHostOfCacheStats() {
118 WebCache::UsageStats stats; 119 WebCache::UsageStats stats;
119 WebCache::getUsageStats(&stats); 120 WebCache::getUsageStats(&stats);
120 RenderThread::Get()->Send(new ChromeViewHostMsg_UpdatedCacheStats( 121 if (!cache_stats_recorder_.is_bound())
Sam McNally 2017/02/02 19:43:39 if (!cache_stats_recorder_) {
nigeltao1 2017/02/03 01:47:37 Done.
121 static_cast<uint64_t>(stats.capacity), 122 RenderThread::Get()->GetRemoteInterfaces()->GetInterface(
122 static_cast<uint64_t>(stats.size))); 123 &cache_stats_recorder_);
124 cache_stats_recorder_->RecordCacheStats(stats.capacity, stats.size);
123 } 125 }
124 126
127 chrome::mojom::CacheStatsRecorderPtr cache_stats_recorder_;
128
125 base::WeakPtrFactory<RendererResourceDelegate> weak_factory_; 129 base::WeakPtrFactory<RendererResourceDelegate> weak_factory_;
126 130
127 DISALLOW_COPY_AND_ASSIGN(RendererResourceDelegate); 131 DISALLOW_COPY_AND_ASSIGN(RendererResourceDelegate);
128 }; 132 };
129 133
130 static const int kWaitForWorkersStatsTimeoutMS = 20; 134 static const int kWaitForWorkersStatsTimeoutMS = 20;
131 135
132 class ResourceUsageReporterImpl : public chrome::mojom::ResourceUsageReporter { 136 class ResourceUsageReporterImpl : public chrome::mojom::ResourceUsageReporter {
133 public: 137 public:
134 explicit ResourceUsageReporterImpl( 138 explicit ResourceUsageReporterImpl(
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 void ChromeRenderThreadObserver::OnSetFieldTrialGroup( 336 void ChromeRenderThreadObserver::OnSetFieldTrialGroup(
333 const std::string& trial_name, 337 const std::string& trial_name,
334 const std::string& group_name) { 338 const std::string& group_name) {
335 field_trial_syncer_.OnSetFieldTrialGroup(trial_name, group_name); 339 field_trial_syncer_.OnSetFieldTrialGroup(trial_name, group_name);
336 } 340 }
337 341
338 const RendererContentSettingRules* 342 const RendererContentSettingRules*
339 ChromeRenderThreadObserver::content_setting_rules() const { 343 ChromeRenderThreadObserver::content_setting_rules() const {
340 return &content_setting_rules_; 344 return &content_setting_rules_;
341 } 345 }
OLDNEW
« no previous file with comments | « chrome/common/render_messages.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698