Chromium Code Reviews| 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..3366d504bcc306a1a6769a44d245643e9b430a60 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/chrome_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" |
| @@ -63,27 +64,39 @@ class NetBenchmarkingWrapper : public v8::Extension { |
| } |
| static void ClearCache(const v8::FunctionCallbackInfo<v8::Value>& args) { |
| - int rv; |
| - content::RenderThread::Get()->Send(new ChromeViewHostMsg_ClearCache(&rv)); |
| - WebCache::clear(); |
| + content::RenderThread* thread = content::RenderThread::Get(); |
| + chrome::mojom::ChromeNetBenchmarkingPtr chrome_net_benchmarking; |
| + thread->GetRemoteInterfaces()->GetInterface(&chrome_net_benchmarking); |
|
Sam McNally
2016/12/05 06:57:10
I think I'd prefer a single shared connection inst
dvallet
2016/12/07 02:21:03
Done, not sure if correctly though, PTAL
|
| + |
| + chrome::mojom::ChromeNetBenchmarking::ClearCacheCallback callback; |
| + chrome_net_benchmarking->ClearCache(callback); |
| } |
| static void ClearHostResolverCache( |
| const v8::FunctionCallbackInfo<v8::Value>& args) { |
| - content::RenderThread::Get()->Send( |
| - new ChromeViewHostMsg_ClearHostResolverCache()); |
| + content::RenderThread* thread = content::RenderThread::Get(); |
| + chrome::mojom::ChromeNetBenchmarkingPtr chrome_net_benchmarking; |
| + |
| + thread->GetRemoteInterfaces()->GetInterface(&chrome_net_benchmarking); |
| + chrome_net_benchmarking->ClearHostResolverCache(); |
| } |
| static void ClearPredictorCache( |
| const v8::FunctionCallbackInfo<v8::Value>& args) { |
| - content::RenderThread::Get()->Send( |
| - new ChromeViewHostMsg_ClearPredictorCache()); |
| + content::RenderThread* thread = content::RenderThread::Get(); |
| + chrome::mojom::ChromeNetBenchmarkingPtr chrome_net_benchmarking; |
| + |
| + thread->GetRemoteInterfaces()->GetInterface(&chrome_net_benchmarking); |
| + chrome_net_benchmarking->ClearPredictorCache(); |
| } |
| static void CloseConnections( |
| const v8::FunctionCallbackInfo<v8::Value>& args) { |
| - content::RenderThread::Get()->Send( |
| - new ChromeViewHostMsg_CloseCurrentConnections()); |
| + content::RenderThread* thread = content::RenderThread::Get(); |
| + chrome::mojom::ChromeNetBenchmarkingPtr chrome_net_benchmarking; |
| + |
| + thread->GetRemoteInterfaces()->GetInterface(&chrome_net_benchmarking); |
| + chrome_net_benchmarking->CloseCurrentConnections(); |
| } |
| }; |