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

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

Issue 2755813002: Begin to wean child processes off reliance on a persistent service_manager::Connection to the brows… (Closed)
Patch Set: . Created 3 years, 9 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/net_benchmarking_extension.h" 5 #include "chrome/renderer/net_benchmarking_extension.h"
6 6
7 #include "chrome/common/net_benchmarking.mojom.h" 7 #include "chrome/common/net_benchmarking.mojom.h"
8 #include "content/public/common/service_names.mojom.h"
8 #include "content/public/renderer/render_thread.h" 9 #include "content/public/renderer/render_thread.h"
9 #include "services/service_manager/public/cpp/interface_provider.h" 10 #include "services/service_manager/public/cpp/connector.h"
10 #include "third_party/WebKit/public/platform/WebCache.h" 11 #include "third_party/WebKit/public/platform/WebCache.h"
11 #include "v8/include/v8.h" 12 #include "v8/include/v8.h"
12 13
13 using blink::WebCache; 14 using blink::WebCache;
14 15
15 const char kNetBenchmarkingExtensionName[] = "v8/NetBenchmarking"; 16 const char kNetBenchmarkingExtensionName[] = "v8/NetBenchmarking";
16 17
17 namespace extensions_v8 { 18 namespace extensions_v8 {
18 19
19 class NetBenchmarkingWrapper : public v8::Extension { 20 class NetBenchmarkingWrapper : public v8::Extension {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 } 65 }
65 66
66 static chrome::mojom::NetBenchmarking& GetNetBenchmarking() { 67 static chrome::mojom::NetBenchmarking& GetNetBenchmarking() {
67 CR_DEFINE_STATIC_LOCAL(chrome::mojom::NetBenchmarkingPtr, net_benchmarking, 68 CR_DEFINE_STATIC_LOCAL(chrome::mojom::NetBenchmarkingPtr, net_benchmarking,
68 (ConnectToBrowser())); 69 (ConnectToBrowser()));
69 return *net_benchmarking; 70 return *net_benchmarking;
70 } 71 }
71 72
72 static chrome::mojom::NetBenchmarkingPtr ConnectToBrowser() { 73 static chrome::mojom::NetBenchmarkingPtr ConnectToBrowser() {
73 chrome::mojom::NetBenchmarkingPtr net_benchmarking; 74 chrome::mojom::NetBenchmarkingPtr net_benchmarking;
74 content::RenderThread::Get()->GetRemoteInterfaces()->GetInterface( 75 content::RenderThread::Get()->GetConnector()->BindInterface(
75 &net_benchmarking); 76 content::mojom::kBrowserServiceName, &net_benchmarking);
76 return net_benchmarking; 77 return net_benchmarking;
77 } 78 }
78 79
79 static void ClearCache(const v8::FunctionCallbackInfo<v8::Value>& args) { 80 static void ClearCache(const v8::FunctionCallbackInfo<v8::Value>& args) {
80 int rv; 81 int rv;
81 GetNetBenchmarking().ClearCache(&rv); 82 GetNetBenchmarking().ClearCache(&rv);
82 WebCache::clear(); 83 WebCache::clear();
83 } 84 }
84 85
85 static void ClearHostResolverCache( 86 static void ClearHostResolverCache(
(...skipping 10 matching lines...) Expand all
96 const v8::FunctionCallbackInfo<v8::Value>& args) { 97 const v8::FunctionCallbackInfo<v8::Value>& args) {
97 GetNetBenchmarking().CloseCurrentConnections(); 98 GetNetBenchmarking().CloseCurrentConnections();
98 } 99 }
99 }; 100 };
100 101
101 v8::Extension* NetBenchmarkingExtension::Get() { 102 v8::Extension* NetBenchmarkingExtension::Get() {
102 return new NetBenchmarkingWrapper(); 103 return new NetBenchmarkingWrapper();
103 } 104 }
104 105
105 } // namespace extensions_v8 106 } // namespace extensions_v8
OLDNEW
« no previous file with comments | « chrome/renderer/leak_detector/leak_detector_remote_client.cc ('k') | chromecast/renderer/cast_content_renderer_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698