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 22 matching lines...) Expand all Loading... |
33 #include "content/common/gpu/client/gpu_channel_host.h" | 33 #include "content/common/gpu/client/gpu_channel_host.h" |
34 #include "content/common/gpu/gpu_messages.h" | 34 #include "content/common/gpu/gpu_messages.h" |
35 #include "content/common/indexed_db/indexed_db_dispatcher.h" | 35 #include "content/common/indexed_db/indexed_db_dispatcher.h" |
36 #include "content/common/indexed_db/indexed_db_message_filter.h" | 36 #include "content/common/indexed_db/indexed_db_message_filter.h" |
37 #include "content/common/npobject_util.h" | 37 #include "content/common/npobject_util.h" |
38 #include "content/common/plugin_messages.h" | 38 #include "content/common/plugin_messages.h" |
39 #include "content/common/resource_dispatcher.h" | 39 #include "content/common/resource_dispatcher.h" |
40 #include "content/common/resource_messages.h" | 40 #include "content/common/resource_messages.h" |
41 #include "content/common/view_messages.h" | 41 #include "content/common/view_messages.h" |
42 #include "content/common/web_database_observer_impl.h" | 42 #include "content/common/web_database_observer_impl.h" |
| 43 #include "content/public/common/compositor_util.h" |
43 #include "content/public/common/content_constants.h" | 44 #include "content/public/common/content_constants.h" |
44 #include "content/public/common/content_paths.h" | 45 #include "content/public/common/content_paths.h" |
45 #include "content/public/common/content_switches.h" | 46 #include "content/public/common/content_switches.h" |
46 #include "content/public/common/renderer_preferences.h" | 47 #include "content/public/common/renderer_preferences.h" |
47 #include "content/public/common/url_constants.h" | 48 #include "content/public/common/url_constants.h" |
48 #include "content/public/renderer/content_renderer_client.h" | 49 #include "content/public/renderer/content_renderer_client.h" |
49 #include "content/public/renderer/render_process_observer.h" | 50 #include "content/public/renderer/render_process_observer.h" |
50 #include "content/public/renderer/render_view_visitor.h" | 51 #include "content/public/renderer/render_view_visitor.h" |
51 #include "content/renderer/browser_plugin/old/browser_plugin_channel_manager.h" | 52 #include "content/renderer/browser_plugin/old/browser_plugin_channel_manager.h" |
52 #include "content/renderer/browser_plugin/old/browser_plugin_registry.h" | 53 #include "content/renderer/browser_plugin/old/browser_plugin_registry.h" |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 ScheduleIdleHandler(kLongIdleHandlerDelayMs); | 487 ScheduleIdleHandler(kLongIdleHandlerDelayMs); |
487 } | 488 } |
488 | 489 |
489 void RenderThreadImpl::EnsureWebKitInitialized() { | 490 void RenderThreadImpl::EnsureWebKitInitialized() { |
490 if (webkit_platform_support_.get()) | 491 if (webkit_platform_support_.get()) |
491 return; | 492 return; |
492 | 493 |
493 webkit_platform_support_.reset(new RendererWebKitPlatformSupportImpl); | 494 webkit_platform_support_.reset(new RendererWebKitPlatformSupportImpl); |
494 WebKit::initialize(webkit_platform_support_.get()); | 495 WebKit::initialize(webkit_platform_support_.get()); |
495 | 496 |
496 base::FieldTrial* thread_trial = | |
497 base::FieldTrialList::Find(content::kGpuCompositingFieldTrialName); | |
498 bool is_thread_trial = thread_trial && thread_trial->group_name() == | |
499 content::kGpuCompositingFieldTrialThreadEnabledName; | |
500 bool has_enable = CommandLine::ForCurrentProcess()->HasSwitch( | |
501 switches::kEnableThreadedCompositing); | |
502 bool has_disable = CommandLine::ForCurrentProcess()->HasSwitch( | |
503 switches::kDisableThreadedCompositing); | |
504 // TODO(fsamuel): Guests don't currently support threaded compositing. | 497 // TODO(fsamuel): Guests don't currently support threaded compositing. |
505 // This should go away with the new design of the browser plugin. | 498 // This should go away with the new design of the browser plugin. |
506 // The new design can be tracked at: http://crbug.com/134492. | 499 // The new design can be tracked at: http://crbug.com/134492. |
507 bool is_guest = CommandLine::ForCurrentProcess()->HasSwitch( | 500 bool is_guest = CommandLine::ForCurrentProcess()->HasSwitch( |
508 switches::kGuestRenderer); | 501 switches::kGuestRenderer); |
509 DCHECK(!is_thread_trial || !has_disable); | 502 bool enable = compositor_util::IsThreadedCompositingEnabled() && !is_guest; |
510 bool enable = (is_thread_trial || (has_enable && !has_disable)) && !is_guest; | |
511 if (enable) { | 503 if (enable) { |
512 compositor_thread_.reset(new CompositorThread(this)); | 504 compositor_thread_.reset(new CompositorThread(this)); |
513 AddFilter(compositor_thread_->GetMessageFilter()); | 505 AddFilter(compositor_thread_->GetMessageFilter()); |
514 WebKit::WebCompositor::initialize(compositor_thread_->GetWebThread()); | 506 WebKit::WebCompositor::initialize(compositor_thread_->GetWebThread()); |
515 } else { | 507 } else { |
516 WebKit::WebCompositor::initialize(NULL); | 508 WebKit::WebCompositor::initialize(NULL); |
517 } | 509 } |
518 compositor_initialized_ = true; | 510 compositor_initialized_ = true; |
519 | 511 |
520 WebScriptController::enableV8SingleThreadMode(); | 512 WebScriptController::enableV8SingleThreadMode(); |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 | 1047 |
1056 scoped_refptr<base::MessageLoopProxy> | 1048 scoped_refptr<base::MessageLoopProxy> |
1057 RenderThreadImpl::GetFileThreadMessageLoopProxy() { | 1049 RenderThreadImpl::GetFileThreadMessageLoopProxy() { |
1058 DCHECK(message_loop() == MessageLoop::current()); | 1050 DCHECK(message_loop() == MessageLoop::current()); |
1059 if (!file_thread_.get()) { | 1051 if (!file_thread_.get()) { |
1060 file_thread_.reset(new base::Thread("Renderer::FILE")); | 1052 file_thread_.reset(new base::Thread("Renderer::FILE")); |
1061 file_thread_->Start(); | 1053 file_thread_->Start(); |
1062 } | 1054 } |
1063 return file_thread_->message_loop_proxy(); | 1055 return file_thread_->message_loop_proxy(); |
1064 } | 1056 } |
OLD | NEW |