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 <vector> | 10 #include <vector> |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 #include "content/common/gpu/client/gpu_channel_host.h" | 61 #include "content/common/gpu/client/gpu_channel_host.h" |
62 #include "content/common/gpu/gpu_messages.h" | 62 #include "content/common/gpu/gpu_messages.h" |
63 #include "content/common/gpu/gpu_process_launch_causes.h" | 63 #include "content/common/gpu/gpu_process_launch_causes.h" |
64 #include "content/common/render_frame_setup.mojom.h" | 64 #include "content/common/render_frame_setup.mojom.h" |
65 #include "content/common/resource_messages.h" | 65 #include "content/common/resource_messages.h" |
66 #include "content/common/view_messages.h" | 66 #include "content/common/view_messages.h" |
67 #include "content/common/worker_messages.h" | 67 #include "content/common/worker_messages.h" |
68 #include "content/public/common/content_constants.h" | 68 #include "content/public/common/content_constants.h" |
69 #include "content/public/common/content_paths.h" | 69 #include "content/public/common/content_paths.h" |
70 #include "content/public/common/content_switches.h" | 70 #include "content/public/common/content_switches.h" |
71 #include "content/public/common/mojo_channel_switches.h" | |
72 #include "content/public/common/renderer_preferences.h" | 71 #include "content/public/common/renderer_preferences.h" |
73 #include "content/public/common/url_constants.h" | 72 #include "content/public/common/url_constants.h" |
74 #include "content/public/renderer/content_renderer_client.h" | 73 #include "content/public/renderer/content_renderer_client.h" |
75 #include "content/public/renderer/render_process_observer.h" | 74 #include "content/public/renderer/render_process_observer.h" |
76 #include "content/public/renderer/render_view_visitor.h" | 75 #include "content/public/renderer/render_view_visitor.h" |
77 #include "content/renderer/browser_plugin/browser_plugin_manager.h" | 76 #include "content/renderer/browser_plugin/browser_plugin_manager.h" |
78 #include "content/renderer/cache_storage/cache_storage_dispatcher.h" | 77 #include "content/renderer/cache_storage/cache_storage_dispatcher.h" |
79 #include "content/renderer/cache_storage/cache_storage_message_filter.h" | 78 #include "content/renderer/cache_storage/cache_storage_message_filter.h" |
80 #include "content/renderer/devtools/devtools_agent_filter.h" | 79 #include "content/renderer/devtools/devtools_agent_filter.h" |
81 #include "content/renderer/devtools/v8_sampling_profiler.h" | 80 #include "content/renderer/devtools/v8_sampling_profiler.h" |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 common_host_histogram_suffix_ = HostToCustomHistogramSuffix(host); | 437 common_host_histogram_suffix_ = HostToCustomHistogramSuffix(host); |
439 blink::mainThreadIsolate()->SetCreateHistogramFunction(CreateHistogram); | 438 blink::mainThreadIsolate()->SetCreateHistogramFunction(CreateHistogram); |
440 } | 439 } |
441 } | 440 } |
442 | 441 |
443 RenderThreadImpl* RenderThreadImpl::current() { | 442 RenderThreadImpl* RenderThreadImpl::current() { |
444 return lazy_tls.Pointer()->Get(); | 443 return lazy_tls.Pointer()->Get(); |
445 } | 444 } |
446 | 445 |
447 RenderThreadImpl::RenderThreadImpl(const InProcessChildThreadParams& params) | 446 RenderThreadImpl::RenderThreadImpl(const InProcessChildThreadParams& params) |
448 : ChildThreadImpl(Options::Builder() | 447 : ChildThreadImpl(Options::Builder().InBrowserProcess(params).Build()) { |
449 .InBrowserProcess(params) | |
450 .UseMojoChannel(ShouldUseMojoChannel()) | |
451 .Build()) { | |
452 Init(); | 448 Init(); |
453 } | 449 } |
454 | 450 |
455 // When we run plugins in process, we actually run them on the render thread, | 451 // When we run plugins in process, we actually run them on the render thread, |
456 // which means that we need to make the render thread pump UI events. | 452 // which means that we need to make the render thread pump UI events. |
457 RenderThreadImpl::RenderThreadImpl( | 453 RenderThreadImpl::RenderThreadImpl( |
458 scoped_ptr<base::MessageLoop> main_message_loop) | 454 scoped_ptr<base::MessageLoop> main_message_loop) |
459 : ChildThreadImpl(Options::Builder() | 455 : ChildThreadImpl(Options::Builder().Build()), |
460 .UseMojoChannel(ShouldUseMojoChannel()) | |
461 .Build()), | |
462 main_message_loop_(main_message_loop.Pass()) { | 456 main_message_loop_(main_message_loop.Pass()) { |
463 Init(); | 457 Init(); |
464 } | 458 } |
465 | 459 |
466 void RenderThreadImpl::Init() { | 460 void RenderThreadImpl::Init() { |
467 TRACE_EVENT_BEGIN_ETW("RenderThreadImpl::Init", 0, ""); | 461 TRACE_EVENT_BEGIN_ETW("RenderThreadImpl::Init", 0, ""); |
468 | 462 |
469 base::trace_event::TraceLog::GetInstance()->SetThreadSortIndex( | 463 base::trace_event::TraceLog::GetInstance()->SetThreadSortIndex( |
470 base::PlatformThread::CurrentId(), | 464 base::PlatformThread::CurrentId(), |
471 kTraceEventRendererMainThreadSortIndex); | 465 kTraceEventRendererMainThreadSortIndex); |
(...skipping 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1850 } | 1844 } |
1851 | 1845 |
1852 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { | 1846 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { |
1853 size_t erased = | 1847 size_t erased = |
1854 RenderThreadImpl::current()->pending_render_frame_connects_.erase( | 1848 RenderThreadImpl::current()->pending_render_frame_connects_.erase( |
1855 routing_id_); | 1849 routing_id_); |
1856 DCHECK_EQ(1u, erased); | 1850 DCHECK_EQ(1u, erased); |
1857 } | 1851 } |
1858 | 1852 |
1859 } // namespace content | 1853 } // namespace content |
OLD | NEW |