| 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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 private: | 359 private: |
| 360 int32_t routing_id_highmark_; | 360 int32_t routing_id_highmark_; |
| 361 }; | 361 }; |
| 362 | 362 |
| 363 void CreateFrameFactory(mojom::FrameFactoryRequest request) { | 363 void CreateFrameFactory(mojom::FrameFactoryRequest request) { |
| 364 mojo::MakeStrongBinding(base::MakeUnique<FrameFactoryImpl>(), | 364 mojo::MakeStrongBinding(base::MakeUnique<FrameFactoryImpl>(), |
| 365 std::move(request)); | 365 std::move(request)); |
| 366 } | 366 } |
| 367 | 367 |
| 368 void SetupEmbeddedWorkerOnWorkerThread( | 368 void SetupEmbeddedWorkerOnWorkerThread( |
| 369 service_manager::mojom::InterfaceProviderRequest request, | 369 mojom::ServiceWorkerEventDispatcherRequest request) { |
| 370 service_manager::mojom::InterfaceProviderPtrInfo remote_interfaces) { | |
| 371 ServiceWorkerContextClient* client = | 370 ServiceWorkerContextClient* client = |
| 372 ServiceWorkerContextClient::ThreadSpecificInstance(); | 371 ServiceWorkerContextClient::ThreadSpecificInstance(); |
| 373 // It is possible for client to be null if for some reason the worker died | 372 // It is possible for client to be null if for some reason the worker died |
| 374 // before this call made it to the worker thread. In that case just do | 373 // before this call made it to the worker thread. In that case just do |
| 375 // nothing and let mojo close the connection. | 374 // nothing and let mojo close the connection. |
| 376 if (!client) | 375 if (!client) |
| 377 return; | 376 return; |
| 378 client->BindInterfaceProviders(std::move(request), | 377 client->BindEventDispatcher(std::move(request)); |
| 379 mojo::MakeProxy(std::move(remote_interfaces))); | |
| 380 } | 378 } |
| 381 | 379 |
| 382 class EmbeddedWorkerSetupImpl : public mojom::EmbeddedWorkerSetup { | 380 class EmbeddedWorkerSetupImpl : public mojom::EmbeddedWorkerSetup { |
| 383 public: | 381 public: |
| 384 EmbeddedWorkerSetupImpl() = default; | 382 EmbeddedWorkerSetupImpl() = default; |
| 385 | 383 |
| 386 void ExchangeInterfaceProviders( | 384 void AttachServiceWorkerEventDispatcher( |
| 387 int32_t thread_id, | 385 int32_t thread_id, |
| 388 service_manager::mojom::InterfaceProviderRequest request, | 386 mojom::ServiceWorkerEventDispatcherRequest request) override { |
| 389 service_manager::mojom::InterfaceProviderPtr remote_interfaces) override { | |
| 390 WorkerThreadRegistry::Instance()->GetTaskRunnerFor(thread_id)->PostTask( | 387 WorkerThreadRegistry::Instance()->GetTaskRunnerFor(thread_id)->PostTask( |
| 391 FROM_HERE, | 388 FROM_HERE, |
| 392 base::Bind(&SetupEmbeddedWorkerOnWorkerThread, base::Passed(&request), | 389 base::Bind(&SetupEmbeddedWorkerOnWorkerThread, base::Passed(&request))); |
| 393 base::Passed(remote_interfaces.PassInterface()))); | |
| 394 } | 390 } |
| 395 }; | 391 }; |
| 396 | 392 |
| 397 void CreateEmbeddedWorkerSetup(mojom::EmbeddedWorkerSetupRequest request) { | 393 void CreateEmbeddedWorkerSetup(mojom::EmbeddedWorkerSetupRequest request) { |
| 398 mojo::MakeStrongBinding(base::MakeUnique<EmbeddedWorkerSetupImpl>(), | 394 mojo::MakeStrongBinding(base::MakeUnique<EmbeddedWorkerSetupImpl>(), |
| 399 std::move(request)); | 395 std::move(request)); |
| 400 } | 396 } |
| 401 | 397 |
| 402 scoped_refptr<ContextProviderCommandBuffer> CreateOffscreenContext( | 398 scoped_refptr<ContextProviderCommandBuffer> CreateOffscreenContext( |
| 403 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host, | 399 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host, |
| (...skipping 2085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2489 } | 2485 } |
| 2490 } | 2486 } |
| 2491 | 2487 |
| 2492 void RenderThreadImpl::OnRendererInterfaceRequest( | 2488 void RenderThreadImpl::OnRendererInterfaceRequest( |
| 2493 mojom::RendererAssociatedRequest request) { | 2489 mojom::RendererAssociatedRequest request) { |
| 2494 DCHECK(!renderer_binding_.is_bound()); | 2490 DCHECK(!renderer_binding_.is_bound()); |
| 2495 renderer_binding_.Bind(std::move(request)); | 2491 renderer_binding_.Bind(std::move(request)); |
| 2496 } | 2492 } |
| 2497 | 2493 |
| 2498 } // namespace content | 2494 } // namespace content |
| OLD | NEW |