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

Side by Side Diff: components/web_cache/renderer/web_cache_impl.cc

Issue 2823693002: Migrate RenderThreadImpl to use ConnectionFilter instead of the ChildThread's InterfaceRegistry to … (Closed)
Patch Set: . Created 3 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/web_cache/renderer/web_cache_impl.h" 5 #include "components/web_cache/renderer/web_cache_impl.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/numerics/safe_conversions.h" 10 #include "base/numerics/safe_conversions.h"
11 #include "content/public/child/child_thread.h"
12 #include "content/public/common/service_manager_connection.h"
13 #include "content/public/common/simple_connection_filter.h"
11 #include "content/public/renderer/render_thread.h" 14 #include "content/public/renderer/render_thread.h"
12 #include "services/service_manager/public/cpp/interface_registry.h" 15 #include "services/service_manager/public/cpp/binder_registry.h"
13 #include "third_party/WebKit/public/platform/WebCache.h" 16 #include "third_party/WebKit/public/platform/WebCache.h"
14 17
15 namespace web_cache { 18 namespace web_cache {
16 19
17 WebCacheImpl::WebCacheImpl() : clear_cache_state_(kInit) { 20 WebCacheImpl::WebCacheImpl() : clear_cache_state_(kInit) {
18 service_manager::InterfaceRegistry* registry = 21 auto registry = base::MakeUnique<service_manager::BinderRegistry>();
19 content::RenderThread::Get()->GetInterfaceRegistry();
20 registry->AddInterface( 22 registry->AddInterface(
21 base::Bind(&WebCacheImpl::BindRequest, base::Unretained(this))); 23 base::Bind(&WebCacheImpl::BindRequest, base::Unretained(this)),
24 base::ThreadTaskRunnerHandle::Get());
25 if (content::ChildThread::Get()) {
26 content::ChildThread::Get()
27 ->GetServiceManagerConnection()
28 ->AddConnectionFilter(base::MakeUnique<content::SimpleConnectionFilter>(
29 std::move(registry)));
30 }
22 } 31 }
23 32
24 WebCacheImpl::~WebCacheImpl() {} 33 WebCacheImpl::~WebCacheImpl() {}
25 34
26 void WebCacheImpl::BindRequest( 35 void WebCacheImpl::BindRequest(mojom::WebCacheRequest web_cache_request) {
27 mojo::InterfaceRequest<mojom::WebCache> web_cache_request) {
28 bindings_.AddBinding(this, std::move(web_cache_request)); 36 bindings_.AddBinding(this, std::move(web_cache_request));
29 } 37 }
30 38
31 void WebCacheImpl::ExecutePendingClearCache() { 39 void WebCacheImpl::ExecutePendingClearCache() {
32 switch (clear_cache_state_) { 40 switch (clear_cache_state_) {
33 case kInit: 41 case kInit:
34 clear_cache_state_ = kNavigate_Pending; 42 clear_cache_state_ = kNavigate_Pending;
35 break; 43 break;
36 case kNavigate_Pending: 44 case kNavigate_Pending:
37 break; 45 break;
(...skipping 23 matching lines...) Expand all
61 case kNavigate_Pending: 69 case kNavigate_Pending:
62 blink::WebCache::Clear(); 70 blink::WebCache::Clear();
63 clear_cache_state_ = kInit; 71 clear_cache_state_ = kInit;
64 break; 72 break;
65 case kClearCache_Pending: 73 case kClearCache_Pending:
66 break; 74 break;
67 } 75 }
68 } 76 }
69 77
70 } // namespace web_cache 78 } // namespace web_cache
OLDNEW
« no previous file with comments | « components/web_cache/renderer/web_cache_impl.h ('k') | content/public/renderer/content_renderer_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698