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

Side by Side Diff: content/browser/service_worker/embedded_worker_test_helper.cc

Issue 1686223002: Move InterfaceProvider into the shell::mojom namespace like the rest of the shell interfaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 10 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 "content/browser/service_worker/embedded_worker_test_helper.h" 5 #include "content/browser/service_worker/embedded_worker_test_helper.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 class EmbeddedWorkerTestHelper::MockEmbeddedWorkerSetup 53 class EmbeddedWorkerTestHelper::MockEmbeddedWorkerSetup
54 : public EmbeddedWorkerSetup { 54 : public EmbeddedWorkerSetup {
55 public: 55 public:
56 static void Create(const base::WeakPtr<EmbeddedWorkerTestHelper>& helper, 56 static void Create(const base::WeakPtr<EmbeddedWorkerTestHelper>& helper,
57 mojo::InterfaceRequest<EmbeddedWorkerSetup> request) { 57 mojo::InterfaceRequest<EmbeddedWorkerSetup> request) {
58 new MockEmbeddedWorkerSetup(helper, std::move(request)); 58 new MockEmbeddedWorkerSetup(helper, std::move(request));
59 } 59 }
60 60
61 void ExchangeInterfaceProviders( 61 void ExchangeInterfaceProviders(
62 int32_t thread_id, 62 int32_t thread_id,
63 mojo::InterfaceRequest<mojo::InterfaceProvider> services, 63 mojo::shell::mojom::InterfaceProviderRequest services,
64 mojo::InterfaceProviderPtr exposed_services) override { 64 mojo::shell::mojom::InterfaceProviderPtr exposed_services) override {
65 if (!helper_) 65 if (!helper_)
66 return; 66 return;
67 helper_->OnSetupMojoStub(thread_id, std::move(services), 67 helper_->OnSetupMojoStub(thread_id, std::move(services),
68 std::move(exposed_services)); 68 std::move(exposed_services));
69 } 69 }
70 70
71 private: 71 private:
72 MockEmbeddedWorkerSetup(const base::WeakPtr<EmbeddedWorkerTestHelper>& helper, 72 MockEmbeddedWorkerSetup(const base::WeakPtr<EmbeddedWorkerTestHelper>& helper,
73 mojo::InterfaceRequest<EmbeddedWorkerSetup> request) 73 mojo::InterfaceRequest<EmbeddedWorkerSetup> request)
74 : helper_(helper), binding_(this, std::move(request)) {} 74 : helper_(helper), binding_(this, std::move(request)) {}
(...skipping 18 matching lines...) Expand all
93 wrapper_->process_manager()->SetProcessIdForTest(mock_render_process_id()); 93 wrapper_->process_manager()->SetProcessIdForTest(mock_render_process_id());
94 wrapper_->process_manager()->SetNewProcessIdForTest(new_render_process_id()); 94 wrapper_->process_manager()->SetNewProcessIdForTest(new_render_process_id());
95 registry()->AddChildProcessSender(mock_render_process_id_, this, 95 registry()->AddChildProcessSender(mock_render_process_id_, this,
96 NewMessagePortMessageFilter()); 96 NewMessagePortMessageFilter());
97 97
98 // Setup process level mojo service registry pair. 98 // Setup process level mojo service registry pair.
99 scoped_ptr<ServiceRegistryImpl> host_service_registry( 99 scoped_ptr<ServiceRegistryImpl> host_service_registry(
100 new ServiceRegistryImpl); 100 new ServiceRegistryImpl);
101 render_process_service_registry_.ServiceRegistry::AddService( 101 render_process_service_registry_.ServiceRegistry::AddService(
102 base::Bind(&MockEmbeddedWorkerSetup::Create, weak_factory_.GetWeakPtr())); 102 base::Bind(&MockEmbeddedWorkerSetup::Create, weak_factory_.GetWeakPtr()));
103 mojo::InterfaceProviderPtr services; 103 mojo::shell::mojom::InterfaceProviderPtr services;
104 render_process_service_registry_.Bind(mojo::GetProxy(&services)); 104 render_process_service_registry_.Bind(mojo::GetProxy(&services));
105 host_service_registry->BindRemoteServiceProvider(std::move(services)); 105 host_service_registry->BindRemoteServiceProvider(std::move(services));
106 render_process_host_->SetServiceRegistry(std::move(host_service_registry)); 106 render_process_host_->SetServiceRegistry(std::move(host_service_registry));
107 } 107 }
108 108
109 EmbeddedWorkerTestHelper::~EmbeddedWorkerTestHelper() { 109 EmbeddedWorkerTestHelper::~EmbeddedWorkerTestHelper() {
110 if (wrapper_.get()) 110 if (wrapper_.get())
111 wrapper_->Shutdown(); 111 wrapper_->Shutdown();
112 } 112 }
113 113
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 int request_id, 377 int request_id,
378 const PushEventPayload& payload) { 378 const PushEventPayload& payload) {
379 base::ThreadTaskRunnerHandle::Get()->PostTask( 379 base::ThreadTaskRunnerHandle::Get()->PostTask(
380 FROM_HERE, base::Bind(&EmbeddedWorkerTestHelper::OnPushEvent, 380 FROM_HERE, base::Bind(&EmbeddedWorkerTestHelper::OnPushEvent,
381 weak_factory_.GetWeakPtr(), 381 weak_factory_.GetWeakPtr(),
382 current_embedded_worker_id_, request_id, payload)); 382 current_embedded_worker_id_, request_id, payload));
383 } 383 }
384 384
385 void EmbeddedWorkerTestHelper::OnSetupMojoStub( 385 void EmbeddedWorkerTestHelper::OnSetupMojoStub(
386 int thread_id, 386 int thread_id,
387 mojo::InterfaceRequest<mojo::InterfaceProvider> services, 387 mojo::shell::mojom::InterfaceProviderRequest services,
388 mojo::InterfaceProviderPtr exposed_services) { 388 mojo::shell::mojom::InterfaceProviderPtr exposed_services) {
389 scoped_ptr<ServiceRegistryImpl> new_registry(new ServiceRegistryImpl); 389 scoped_ptr<ServiceRegistryImpl> new_registry(new ServiceRegistryImpl);
390 new_registry->Bind(std::move(services)); 390 new_registry->Bind(std::move(services));
391 new_registry->BindRemoteServiceProvider(std::move(exposed_services)); 391 new_registry->BindRemoteServiceProvider(std::move(exposed_services));
392 OnSetupMojo(new_registry.get()); 392 OnSetupMojo(new_registry.get());
393 thread_id_service_registry_map_.add(thread_id, std::move(new_registry)); 393 thread_id_service_registry_map_.add(thread_id, std::move(new_registry));
394 } 394 }
395 395
396 EmbeddedWorkerRegistry* EmbeddedWorkerTestHelper::registry() { 396 EmbeddedWorkerRegistry* EmbeddedWorkerTestHelper::registry() {
397 DCHECK(context()); 397 DCHECK(context());
398 return context()->embedded_worker_registry(); 398 return context()->embedded_worker_registry();
399 } 399 }
400 400
401 MessagePortMessageFilter* 401 MessagePortMessageFilter*
402 EmbeddedWorkerTestHelper::NewMessagePortMessageFilter() { 402 EmbeddedWorkerTestHelper::NewMessagePortMessageFilter() {
403 scoped_refptr<MessagePortMessageFilter> filter( 403 scoped_refptr<MessagePortMessageFilter> filter(
404 new MockMessagePortMessageFilter); 404 new MockMessagePortMessageFilter);
405 message_port_message_filters_.push_back(filter); 405 message_port_message_filters_.push_back(filter);
406 return filter.get(); 406 return filter.get();
407 } 407 }
408 408
409 } // namespace content 409 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/service_worker/embedded_worker_test_helper.h ('k') | content/child/mojo/mojo_application.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698