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

Unified Diff: chrome/renderer/net_benchmarking_extension.cc

Issue 2521823008: Migrate chrome_net_benchmarking_message_filter to mojo (Closed)
Patch Set: Do not add NetBenchmaring interface if benchmarking is disabled Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/net_benchmarking.mojom ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/net_benchmarking_extension.cc
diff --git a/chrome/renderer/net_benchmarking_extension.cc b/chrome/renderer/net_benchmarking_extension.cc
index 2164281b30e1678a7934c88922425698ab19e274..fa1464fd992b1afe3d99ae3ef7b37a34e949cdbb 100644
--- a/chrome/renderer/net_benchmarking_extension.cc
+++ b/chrome/renderer/net_benchmarking_extension.cc
@@ -4,8 +4,9 @@
#include "chrome/renderer/net_benchmarking_extension.h"
-#include "chrome/common/benchmarking_messages.h"
+#include "chrome/common/net_benchmarking.mojom.h"
#include "content/public/renderer/render_thread.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
#include "third_party/WebKit/public/web/WebCache.h"
#include "v8/include/v8.h"
@@ -62,28 +63,38 @@ class NetBenchmarkingWrapper : public v8::Extension {
return v8::Local<v8::FunctionTemplate>();
}
+ static chrome::mojom::NetBenchmarking& GetNetBenchmarking() {
+ CR_DEFINE_STATIC_LOCAL(chrome::mojom::NetBenchmarkingPtr, net_benchmarking,
+ (ConnectToBrowser()));
+ return *net_benchmarking;
+ }
+
+ static chrome::mojom::NetBenchmarkingPtr ConnectToBrowser() {
+ chrome::mojom::NetBenchmarkingPtr net_benchmarking;
+ content::RenderThread::Get()->GetRemoteInterfaces()->GetInterface(
+ &net_benchmarking);
+ return net_benchmarking;
+ }
+
static void ClearCache(const v8::FunctionCallbackInfo<v8::Value>& args) {
int rv;
- content::RenderThread::Get()->Send(new ChromeViewHostMsg_ClearCache(&rv));
+ GetNetBenchmarking().ClearCache(&rv);
WebCache::clear();
}
static void ClearHostResolverCache(
const v8::FunctionCallbackInfo<v8::Value>& args) {
- content::RenderThread::Get()->Send(
- new ChromeViewHostMsg_ClearHostResolverCache());
+ GetNetBenchmarking().ClearHostResolverCache();
}
static void ClearPredictorCache(
const v8::FunctionCallbackInfo<v8::Value>& args) {
- content::RenderThread::Get()->Send(
- new ChromeViewHostMsg_ClearPredictorCache());
+ GetNetBenchmarking().ClearPredictorCache();
}
static void CloseConnections(
const v8::FunctionCallbackInfo<v8::Value>& args) {
- content::RenderThread::Get()->Send(
- new ChromeViewHostMsg_CloseCurrentConnections());
+ GetNetBenchmarking().CloseCurrentConnections();
}
};
« no previous file with comments | « chrome/common/net_benchmarking.mojom ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698