| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer/render_thread_impl.h" | 5 #include "content/renderer/render_thread_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 private: | 362 private: |
| 363 int32_t routing_id_highmark_; | 363 int32_t routing_id_highmark_; |
| 364 }; | 364 }; |
| 365 | 365 |
| 366 void CreateFrameFactory(mojom::FrameFactoryRequest request) { | 366 void CreateFrameFactory(mojom::FrameFactoryRequest request) { |
| 367 mojo::MakeStrongBinding(base::MakeUnique<FrameFactoryImpl>(), | 367 mojo::MakeStrongBinding(base::MakeUnique<FrameFactoryImpl>(), |
| 368 std::move(request)); | 368 std::move(request)); |
| 369 } | 369 } |
| 370 | 370 |
| 371 void SetupEmbeddedWorkerOnWorkerThread( | 371 void SetupEmbeddedWorkerOnWorkerThread( |
| 372 shell::mojom::InterfaceProviderRequest request, | 372 service_manager::mojom::InterfaceProviderRequest request, |
| 373 shell::mojom::InterfaceProviderPtrInfo remote_interfaces) { | 373 service_manager::mojom::InterfaceProviderPtrInfo remote_interfaces) { |
| 374 ServiceWorkerContextClient* client = | 374 ServiceWorkerContextClient* client = |
| 375 ServiceWorkerContextClient::ThreadSpecificInstance(); | 375 ServiceWorkerContextClient::ThreadSpecificInstance(); |
| 376 // It is possible for client to be null if for some reason the worker died | 376 // It is possible for client to be null if for some reason the worker died |
| 377 // before this call made it to the worker thread. In that case just do | 377 // before this call made it to the worker thread. In that case just do |
| 378 // nothing and let mojo close the connection. | 378 // nothing and let mojo close the connection. |
| 379 if (!client) | 379 if (!client) |
| 380 return; | 380 return; |
| 381 client->BindInterfaceProviders(std::move(request), | 381 client->BindInterfaceProviders(std::move(request), |
| 382 mojo::MakeProxy(std::move(remote_interfaces))); | 382 mojo::MakeProxy(std::move(remote_interfaces))); |
| 383 } | 383 } |
| 384 | 384 |
| 385 class EmbeddedWorkerSetupImpl : public mojom::EmbeddedWorkerSetup { | 385 class EmbeddedWorkerSetupImpl : public mojom::EmbeddedWorkerSetup { |
| 386 public: | 386 public: |
| 387 EmbeddedWorkerSetupImpl() = default; | 387 EmbeddedWorkerSetupImpl() = default; |
| 388 | 388 |
| 389 void ExchangeInterfaceProviders( | 389 void ExchangeInterfaceProviders( |
| 390 int32_t thread_id, | 390 int32_t thread_id, |
| 391 shell::mojom::InterfaceProviderRequest request, | 391 service_manager::mojom::InterfaceProviderRequest request, |
| 392 shell::mojom::InterfaceProviderPtr remote_interfaces) override { | 392 service_manager::mojom::InterfaceProviderPtr remote_interfaces) override { |
| 393 WorkerThreadRegistry::Instance()->GetTaskRunnerFor(thread_id)->PostTask( | 393 WorkerThreadRegistry::Instance()->GetTaskRunnerFor(thread_id)->PostTask( |
| 394 FROM_HERE, | 394 FROM_HERE, |
| 395 base::Bind(&SetupEmbeddedWorkerOnWorkerThread, base::Passed(&request), | 395 base::Bind(&SetupEmbeddedWorkerOnWorkerThread, base::Passed(&request), |
| 396 base::Passed(remote_interfaces.PassInterface()))); | 396 base::Passed(remote_interfaces.PassInterface()))); |
| 397 } | 397 } |
| 398 }; | 398 }; |
| 399 | 399 |
| 400 void CreateEmbeddedWorkerSetup(mojom::EmbeddedWorkerSetupRequest request) { | 400 void CreateEmbeddedWorkerSetup(mojom::EmbeddedWorkerSetupRequest request) { |
| 401 mojo::MakeStrongBinding(base::MakeUnique<EmbeddedWorkerSetupImpl>(), | 401 mojo::MakeStrongBinding(base::MakeUnique<EmbeddedWorkerSetupImpl>(), |
| 402 std::move(request)); | 402 std::move(request)); |
| (...skipping 1954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2357 } | 2357 } |
| 2358 } | 2358 } |
| 2359 | 2359 |
| 2360 void RenderThreadImpl::OnRendererInterfaceRequest( | 2360 void RenderThreadImpl::OnRendererInterfaceRequest( |
| 2361 mojom::RendererAssociatedRequest request) { | 2361 mojom::RendererAssociatedRequest request) { |
| 2362 DCHECK(!renderer_binding_.is_bound()); | 2362 DCHECK(!renderer_binding_.is_bound()); |
| 2363 renderer_binding_.Bind(std::move(request)); | 2363 renderer_binding_.Bind(std::move(request)); |
| 2364 } | 2364 } |
| 2365 | 2365 |
| 2366 } // namespace content | 2366 } // namespace content |
| OLD | NEW |