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

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, 7 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') | chromecast/browser/cast_content_browser_client.h » ('j') | 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>
11 #include <set> 11 #include <set>
12 #include <utility> 12 #include <utility>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/bind.h" 15 #include "base/bind.h"
16 #include "base/command_line.h" 16 #include "base/command_line.h"
17 #include "base/files/file_util.h" 17 #include "base/files/file_util.h"
18 #include "base/location.h" 18 #include "base/location.h"
19 #include "base/macros.h" 19 #include "base/macros.h"
20 #include "base/memory/ptr_util.h" 20 #include "base/memory/ptr_util.h"
21 #include "base/memory/weak_ptr.h" 21 #include "base/memory/weak_ptr.h"
22 #include "base/metrics/histogram.h" 22 #include "base/metrics/histogram.h"
23 #include "base/metrics/statistics_recorder.h" 23 #include "base/metrics/statistics_recorder.h"
24 #include "base/path_service.h" 24 #include "base/path_service.h"
25 #include "base/single_thread_task_runner.h" 25 #include "base/single_thread_task_runner.h"
26 #include "base/strings/utf_string_conversions.h" 26 #include "base/strings/utf_string_conversions.h"
27 #include "base/threading/platform_thread.h" 27 #include "base/threading/platform_thread.h"
28 #include "base/threading/thread_task_runner_handle.h" 28 #include "base/threading/thread_task_runner_handle.h"
29 #include "build/build_config.h" 29 #include "build/build_config.h"
30 #include "chrome/common/cache_stats_recorder.mojom.h"
30 #include "chrome/common/child_process_logging.h" 31 #include "chrome/common/child_process_logging.h"
31 #include "chrome/common/chrome_paths.h" 32 #include "chrome/common/chrome_paths.h"
32 #include "chrome/common/media/media_resource_provider.h" 33 #include "chrome/common/media/media_resource_provider.h"
33 #include "chrome/common/net/net_resource_provider.h" 34 #include "chrome/common/net/net_resource_provider.h"
34 #include "chrome/common/render_messages.h" 35 #include "chrome/common/render_messages.h"
35 #include "chrome/common/resource_usage_reporter.mojom.h" 36 #include "chrome/common/resource_usage_reporter.mojom.h"
36 #include "chrome/common/resource_usage_reporter_type_converters.h" 37 #include "chrome/common/resource_usage_reporter_type_converters.h"
37 #include "chrome/common/url_constants.h" 38 #include "chrome/common/url_constants.h"
38 #include "chrome/renderer/content_settings_observer.h" 39 #include "chrome/renderer/content_settings_observer.h"
39 #include "chrome/renderer/security_filter_peer.h" 40 #include "chrome/renderer/security_filter_peer.h"
40 #include "components/visitedlink/renderer/visitedlink_slave.h" 41 #include "components/visitedlink/renderer/visitedlink_slave.h"
41 #include "content/public/child/child_thread.h" 42 #include "content/public/child/child_thread.h"
42 #include "content/public/child/resource_dispatcher_delegate.h" 43 #include "content/public/child/resource_dispatcher_delegate.h"
43 #include "content/public/common/associated_interface_registry.h" 44 #include "content/public/common/associated_interface_registry.h"
44 #include "content/public/common/content_switches.h" 45 #include "content/public/common/content_switches.h"
45 #include "content/public/common/service_manager_connection.h" 46 #include "content/public/common/service_manager_connection.h"
46 #include "content/public/common/service_names.mojom.h" 47 #include "content/public/common/service_names.mojom.h"
47 #include "content/public/common/simple_connection_filter.h" 48 #include "content/public/common/simple_connection_filter.h"
48 #include "content/public/renderer/render_thread.h" 49 #include "content/public/renderer/render_thread.h"
49 #include "content/public/renderer/render_view.h" 50 #include "content/public/renderer/render_view.h"
50 #include "content/public/renderer/render_view_visitor.h" 51 #include "content/public/renderer/render_view_visitor.h"
51 #include "extensions/features/features.h" 52 #include "extensions/features/features.h"
53 #include "ipc/ipc_sync_channel.h"
52 #include "media/base/localized_strings.h" 54 #include "media/base/localized_strings.h"
53 #include "mojo/public/cpp/bindings/strong_binding.h" 55 #include "mojo/public/cpp/bindings/strong_binding.h"
54 #include "net/base/net_errors.h" 56 #include "net/base/net_errors.h"
55 #include "net/base/net_module.h" 57 #include "net/base/net_module.h"
56 #include "services/service_manager/public/cpp/binder_registry.h" 58 #include "services/service_manager/public/cpp/binder_registry.h"
57 #include "services/service_manager/public/cpp/connector.h" 59 #include "services/service_manager/public/cpp/connector.h"
58 #include "third_party/WebKit/public/platform/WebCache.h" 60 #include "third_party/WebKit/public/platform/WebCache.h"
59 #include "third_party/WebKit/public/web/WebDocument.h" 61 #include "third_party/WebKit/public/web/WebDocument.h"
60 #include "third_party/WebKit/public/web/WebFrame.h" 62 #include "third_party/WebKit/public/web/WebFrame.h"
61 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" 63 #include "third_party/WebKit/public/web/WebSecurityPolicy.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 std::move(current_peer), RenderThread::Get(), mime_type, url); 114 std::move(current_peer), RenderThread::Get(), mime_type, url);
113 #else 115 #else
114 return current_peer; 116 return current_peer;
115 #endif 117 #endif
116 } 118 }
117 119
118 private: 120 private:
119 void InformHostOfCacheStats() { 121 void InformHostOfCacheStats() {
120 WebCache::UsageStats stats; 122 WebCache::UsageStats stats;
121 WebCache::GetUsageStats(&stats); 123 WebCache::GetUsageStats(&stats);
122 RenderThread::Get()->Send(new ChromeViewHostMsg_UpdatedCacheStats( 124 if (!cache_stats_recorder_) {
123 static_cast<uint64_t>(stats.capacity), 125 RenderThread::Get()->GetChannel()->GetRemoteAssociatedInterface(
124 static_cast<uint64_t>(stats.size))); 126 &cache_stats_recorder_);
127 }
128 cache_stats_recorder_->RecordCacheStats(stats.capacity, stats.size);
125 } 129 }
126 130
131 chrome::mojom::CacheStatsRecorderAssociatedPtr cache_stats_recorder_;
132
127 base::WeakPtrFactory<RendererResourceDelegate> weak_factory_; 133 base::WeakPtrFactory<RendererResourceDelegate> weak_factory_;
128 134
129 DISALLOW_COPY_AND_ASSIGN(RendererResourceDelegate); 135 DISALLOW_COPY_AND_ASSIGN(RendererResourceDelegate);
130 }; 136 };
131 137
132 static const int kWaitForWorkersStatsTimeoutMS = 20; 138 static const int kWaitForWorkersStatsTimeoutMS = 20;
133 139
134 class ResourceUsageReporterImpl : public chrome::mojom::ResourceUsageReporter { 140 class ResourceUsageReporterImpl : public chrome::mojom::ResourceUsageReporter {
135 public: 141 public:
136 explicit ResourceUsageReporterImpl( 142 explicit ResourceUsageReporterImpl(
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 321
316 void ChromeRenderThreadObserver::OnRendererConfigurationAssociatedRequest( 322 void ChromeRenderThreadObserver::OnRendererConfigurationAssociatedRequest(
317 chrome::mojom::RendererConfigurationAssociatedRequest request) { 323 chrome::mojom::RendererConfigurationAssociatedRequest request) {
318 renderer_configuration_bindings_.AddBinding(this, std::move(request)); 324 renderer_configuration_bindings_.AddBinding(this, std::move(request));
319 } 325 }
320 326
321 const RendererContentSettingRules* 327 const RendererContentSettingRules*
322 ChromeRenderThreadObserver::content_setting_rules() const { 328 ChromeRenderThreadObserver::content_setting_rules() const {
323 return &content_setting_rules_; 329 return &content_setting_rules_;
324 } 330 }
OLDNEW
« no previous file with comments | « chrome/common/render_messages.h ('k') | chromecast/browser/cast_content_browser_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698