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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 private: | 368 private: |
369 int32_t routing_id_highmark_; | 369 int32_t routing_id_highmark_; |
370 }; | 370 }; |
371 | 371 |
372 void CreateFrameFactory(mojom::FrameFactoryRequest request) { | 372 void CreateFrameFactory(mojom::FrameFactoryRequest request) { |
373 mojo::MakeStrongBinding(base::MakeUnique<FrameFactoryImpl>(), | 373 mojo::MakeStrongBinding(base::MakeUnique<FrameFactoryImpl>(), |
374 std::move(request)); | 374 std::move(request)); |
375 } | 375 } |
376 | 376 |
377 void SetupEmbeddedWorkerOnWorkerThread( | 377 void SetupEmbeddedWorkerOnWorkerThread( |
378 service_manager::mojom::InterfaceProviderRequest request, | 378 mojom::ServiceWorkerEventDispatcherRequest request) { |
379 service_manager::mojom::InterfaceProviderPtrInfo remote_interfaces) { | |
380 ServiceWorkerContextClient* client = | 379 ServiceWorkerContextClient* client = |
381 ServiceWorkerContextClient::ThreadSpecificInstance(); | 380 ServiceWorkerContextClient::ThreadSpecificInstance(); |
382 // It is possible for client to be null if for some reason the worker died | 381 // It is possible for client to be null if for some reason the worker died |
383 // before this call made it to the worker thread. In that case just do | 382 // before this call made it to the worker thread. In that case just do |
384 // nothing and let mojo close the connection. | 383 // nothing and let mojo close the connection. |
385 if (!client) | 384 if (!client) |
386 return; | 385 return; |
387 client->BindInterfaceProviders(std::move(request), | 386 client->BindEventDispatcher(std::move(request)); |
388 mojo::MakeProxy(std::move(remote_interfaces))); | |
389 } | 387 } |
390 | 388 |
391 class EmbeddedWorkerSetupImpl : public mojom::EmbeddedWorkerSetup { | 389 class EmbeddedWorkerSetupImpl : public mojom::EmbeddedWorkerSetup { |
392 public: | 390 public: |
393 EmbeddedWorkerSetupImpl() = default; | 391 EmbeddedWorkerSetupImpl() = default; |
394 | 392 |
395 void ExchangeInterfaceProviders( | 393 void AttachServiceWorkerEventDispatcher( |
396 int32_t thread_id, | 394 int32_t thread_id, |
397 service_manager::mojom::InterfaceProviderRequest request, | 395 mojom::ServiceWorkerEventDispatcherRequest request) override { |
398 service_manager::mojom::InterfaceProviderPtr remote_interfaces) override { | |
399 WorkerThreadRegistry::Instance()->GetTaskRunnerFor(thread_id)->PostTask( | 396 WorkerThreadRegistry::Instance()->GetTaskRunnerFor(thread_id)->PostTask( |
400 FROM_HERE, | 397 FROM_HERE, |
401 base::Bind(&SetupEmbeddedWorkerOnWorkerThread, base::Passed(&request), | 398 base::Bind(&SetupEmbeddedWorkerOnWorkerThread, base::Passed(&request))); |
402 base::Passed(remote_interfaces.PassInterface()))); | |
403 } | 399 } |
404 }; | 400 }; |
405 | 401 |
406 void CreateEmbeddedWorkerSetup(mojom::EmbeddedWorkerSetupRequest request) { | 402 void CreateEmbeddedWorkerSetup(mojom::EmbeddedWorkerSetupRequest request) { |
407 mojo::MakeStrongBinding(base::MakeUnique<EmbeddedWorkerSetupImpl>(), | 403 mojo::MakeStrongBinding(base::MakeUnique<EmbeddedWorkerSetupImpl>(), |
408 std::move(request)); | 404 std::move(request)); |
409 } | 405 } |
410 | 406 |
411 scoped_refptr<ContextProviderCommandBuffer> CreateOffscreenContext( | 407 scoped_refptr<ContextProviderCommandBuffer> CreateOffscreenContext( |
412 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host, | 408 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host, |
(...skipping 2101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2514 } | 2510 } |
2515 } | 2511 } |
2516 | 2512 |
2517 void RenderThreadImpl::OnRendererInterfaceRequest( | 2513 void RenderThreadImpl::OnRendererInterfaceRequest( |
2518 mojom::RendererAssociatedRequest request) { | 2514 mojom::RendererAssociatedRequest request) { |
2519 DCHECK(!renderer_binding_.is_bound()); | 2515 DCHECK(!renderer_binding_.is_bound()); |
2520 renderer_binding_.Bind(std::move(request)); | 2516 renderer_binding_.Bind(std::move(request)); |
2521 } | 2517 } |
2522 | 2518 |
2523 } // namespace content | 2519 } // namespace content |
OLD | NEW |