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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 #include "content/child/thread_safe_sender.h" | 67 #include "content/child/thread_safe_sender.h" |
68 #include "content/child/web_database_observer_impl.h" | 68 #include "content/child/web_database_observer_impl.h" |
69 #include "content/child/worker_thread_registry.h" | 69 #include "content/child/worker_thread_registry.h" |
70 #include "content/common/child_process_messages.h" | 70 #include "content/common/child_process_messages.h" |
71 #include "content/common/content_constants_internal.h" | 71 #include "content/common/content_constants_internal.h" |
72 #include "content/common/dom_storage/dom_storage_messages.h" | 72 #include "content/common/dom_storage/dom_storage_messages.h" |
73 #include "content/common/frame_messages.h" | 73 #include "content/common/frame_messages.h" |
74 #include "content/common/frame_owner_properties.h" | 74 #include "content/common/frame_owner_properties.h" |
75 #include "content/common/render_process_messages.h" | 75 #include "content/common/render_process_messages.h" |
76 #include "content/common/resource_messages.h" | 76 #include "content/common/resource_messages.h" |
77 #include "content/common/service_worker/embedded_worker_setup.mojom.h" | 77 #include "content/common/service_worker/embedded_worker_setup.mojom.h" |
horo
2017/01/16 04:56:31
remove
shimazu
2017/01/16 05:49:53
Done.
| |
78 #include "content/common/site_isolation_policy.h" | 78 #include "content/common/site_isolation_policy.h" |
79 #include "content/common/view_messages.h" | 79 #include "content/common/view_messages.h" |
80 #include "content/common/worker_messages.h" | 80 #include "content/common/worker_messages.h" |
81 #include "content/public/common/content_constants.h" | 81 #include "content/public/common/content_constants.h" |
82 #include "content/public/common/content_features.h" | 82 #include "content/public/common/content_features.h" |
83 #include "content/public/common/content_paths.h" | 83 #include "content/public/common/content_paths.h" |
84 #include "content/public/common/content_switches.h" | 84 #include "content/public/common/content_switches.h" |
85 #include "content/public/common/renderer_preferences.h" | 85 #include "content/public/common/renderer_preferences.h" |
86 #include "content/public/common/url_constants.h" | 86 #include "content/public/common/url_constants.h" |
87 #include "content/public/renderer/content_renderer_client.h" | 87 #include "content/public/renderer/content_renderer_client.h" |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
357 | 357 |
358 private: | 358 private: |
359 int32_t routing_id_highmark_; | 359 int32_t routing_id_highmark_; |
360 }; | 360 }; |
361 | 361 |
362 void CreateFrameFactory(mojom::FrameFactoryRequest request) { | 362 void CreateFrameFactory(mojom::FrameFactoryRequest request) { |
363 mojo::MakeStrongBinding(base::MakeUnique<FrameFactoryImpl>(), | 363 mojo::MakeStrongBinding(base::MakeUnique<FrameFactoryImpl>(), |
364 std::move(request)); | 364 std::move(request)); |
365 } | 365 } |
366 | 366 |
367 void SetupEmbeddedWorkerOnWorkerThread( | |
368 mojom::ServiceWorkerEventDispatcherRequest request) { | |
369 ServiceWorkerContextClient* client = | |
370 ServiceWorkerContextClient::ThreadSpecificInstance(); | |
371 // It is possible for client to be null if for some reason the worker died | |
372 // before this call made it to the worker thread. In that case just do | |
373 // nothing and let mojo close the connection. | |
374 if (!client) | |
375 return; | |
376 client->BindEventDispatcher(std::move(request)); | |
377 } | |
378 | |
379 class EmbeddedWorkerSetupImpl : public mojom::EmbeddedWorkerSetup { | |
380 public: | |
381 EmbeddedWorkerSetupImpl() = default; | |
382 | |
383 void AttachServiceWorkerEventDispatcher( | |
384 int32_t thread_id, | |
385 mojom::ServiceWorkerEventDispatcherRequest request) override { | |
386 WorkerThreadRegistry::Instance()->GetTaskRunnerFor(thread_id)->PostTask( | |
387 FROM_HERE, | |
388 base::Bind(&SetupEmbeddedWorkerOnWorkerThread, base::Passed(&request))); | |
389 } | |
390 }; | |
391 | |
392 void CreateEmbeddedWorkerSetup(mojom::EmbeddedWorkerSetupRequest request) { | |
393 mojo::MakeStrongBinding(base::MakeUnique<EmbeddedWorkerSetupImpl>(), | |
394 std::move(request)); | |
395 } | |
396 | |
397 scoped_refptr<ui::ContextProviderCommandBuffer> CreateOffscreenContext( | 367 scoped_refptr<ui::ContextProviderCommandBuffer> CreateOffscreenContext( |
398 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host, | 368 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host, |
399 const gpu::SharedMemoryLimits& limits, | 369 const gpu::SharedMemoryLimits& limits, |
400 bool support_locking, | 370 bool support_locking, |
401 ui::command_buffer_metrics::ContextType type, | 371 ui::command_buffer_metrics::ContextType type, |
402 int32_t stream_id, | 372 int32_t stream_id, |
403 gpu::GpuStreamPriority stream_priority) { | 373 gpu::GpuStreamPriority stream_priority) { |
404 DCHECK(gpu_channel_host); | 374 DCHECK(gpu_channel_host); |
405 // This is used to create a few different offscreen contexts: | 375 // This is used to create a few different offscreen contexts: |
406 // - The shared main thread context (offscreen) used by blink for canvas. | 376 // - The shared main thread context (offscreen) used by blink for canvas. |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
899 // TODO(boliu): In single process, browser main loop should set up the | 869 // TODO(boliu): In single process, browser main loop should set up the |
900 // discardable memory manager, and should skip this if kSingleProcess. | 870 // discardable memory manager, and should skip this if kSingleProcess. |
901 // See crbug.com/503724. | 871 // See crbug.com/503724. |
902 base::DiscardableMemoryAllocator::SetInstance( | 872 base::DiscardableMemoryAllocator::SetInstance( |
903 discardable_shared_memory_manager_.get()); | 873 discardable_shared_memory_manager_.get()); |
904 | 874 |
905 GetContentClient()->renderer()->ExposeInterfacesToBrowser( | 875 GetContentClient()->renderer()->ExposeInterfacesToBrowser( |
906 GetInterfaceRegistry()); | 876 GetInterfaceRegistry()); |
907 | 877 |
908 GetInterfaceRegistry()->AddInterface(base::Bind(&CreateFrameFactory)); | 878 GetInterfaceRegistry()->AddInterface(base::Bind(&CreateFrameFactory)); |
909 GetInterfaceRegistry()->AddInterface(base::Bind(&CreateEmbeddedWorkerSetup)); | |
910 GetInterfaceRegistry()->AddInterface( | 879 GetInterfaceRegistry()->AddInterface( |
911 base::Bind(&EmbeddedWorkerInstanceClientImpl::Create, | 880 base::Bind(&EmbeddedWorkerInstanceClientImpl::Create, |
912 base::Unretained(embedded_worker_dispatcher_.get()))); | 881 base::Unretained(embedded_worker_dispatcher_.get()))); |
913 | 882 |
914 GetRemoteInterfaces()->GetInterface( | 883 GetRemoteInterfaces()->GetInterface( |
915 mojo::MakeRequest(&storage_partition_service_)); | 884 mojo::MakeRequest(&storage_partition_service_)); |
916 | 885 |
917 #if defined(OS_LINUX) | 886 #if defined(OS_LINUX) |
918 ChildProcess::current()->SetIOThreadPriority(base::ThreadPriority::DISPLAY); | 887 ChildProcess::current()->SetIOThreadPriority(base::ThreadPriority::DISPLAY); |
919 ChildThreadImpl::current()->SetThreadPriority( | 888 ChildThreadImpl::current()->SetThreadPriority( |
(...skipping 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2421 } | 2390 } |
2422 } | 2391 } |
2423 | 2392 |
2424 void RenderThreadImpl::OnRendererInterfaceRequest( | 2393 void RenderThreadImpl::OnRendererInterfaceRequest( |
2425 mojom::RendererAssociatedRequest request) { | 2394 mojom::RendererAssociatedRequest request) { |
2426 DCHECK(!renderer_binding_.is_bound()); | 2395 DCHECK(!renderer_binding_.is_bound()); |
2427 renderer_binding_.Bind(std::move(request)); | 2396 renderer_binding_.Bind(std::move(request)); |
2428 } | 2397 } |
2429 | 2398 |
2430 } // namespace content | 2399 } // namespace content |
OLD | NEW |