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 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 ScheduleIdleHandler(kLongIdleHandlerDelayMs); | 486 ScheduleIdleHandler(kLongIdleHandlerDelayMs); |
486 } | 487 } |
487 | 488 |
488 void RenderThreadImpl::EnsureWebKitInitialized() { | 489 void RenderThreadImpl::EnsureWebKitInitialized() { |
489 if (webkit_platform_support_.get()) | 490 if (webkit_platform_support_.get()) |
490 return; | 491 return; |
491 | 492 |
492 webkit_platform_support_.reset(new RendererWebKitPlatformSupportImpl); | 493 webkit_platform_support_.reset(new RendererWebKitPlatformSupportImpl); |
493 WebKit::initialize(webkit_platform_support_.get()); | 494 WebKit::initialize(webkit_platform_support_.get()); |
494 | 495 |
495 base::FieldTrial* thread_trial = | |
496 base::FieldTrialList::Find(content::kGpuCompositingFieldTrialName); | |
497 bool is_thread_trial = thread_trial && thread_trial->group_name() == | |
498 content::kGpuCompositingFieldTrialThreadEnabledName; | |
499 bool has_enable = CommandLine::ForCurrentProcess()->HasSwitch( | |
500 switches::kEnableThreadedCompositing); | |
501 bool has_disable = CommandLine::ForCurrentProcess()->HasSwitch( | |
502 switches::kDisableThreadedCompositing); | |
503 // TODO(fsamuel): Guests don't currently support threaded compositing. | 496 // TODO(fsamuel): Guests don't currently support threaded compositing. |
504 // This should go away with the new design of the browser plugin. | 497 // This should go away with the new design of the browser plugin. |
505 // The new design can be tracked at: http://crbug.com/134492. | 498 // The new design can be tracked at: http://crbug.com/134492. |
506 bool is_guest = CommandLine::ForCurrentProcess()->HasSwitch( | 499 bool is_guest = CommandLine::ForCurrentProcess()->HasSwitch( |
507 switches::kGuestRenderer); | 500 switches::kGuestRenderer); |
508 DCHECK(!is_thread_trial || !has_disable); | 501 bool enable = content::IsThreadedCompositingEnabled() && !is_guest; |
509 bool enable = (is_thread_trial || (has_enable && !has_disable)) && !is_guest; | |
510 if (enable) { | 502 if (enable) { |
511 compositor_thread_.reset(new CompositorThread(this)); | 503 compositor_thread_.reset(new CompositorThread(this)); |
512 AddFilter(compositor_thread_->GetMessageFilter()); | 504 AddFilter(compositor_thread_->GetMessageFilter()); |
513 WebKit::WebCompositor::initialize(compositor_thread_->GetWebThread()); | 505 WebKit::WebCompositor::initialize(compositor_thread_->GetWebThread()); |
514 } else { | 506 } else { |
515 WebKit::WebCompositor::initialize(NULL); | 507 WebKit::WebCompositor::initialize(NULL); |
516 } | 508 } |
517 compositor_initialized_ = true; | 509 compositor_initialized_ = true; |
518 | 510 |
519 WebScriptController::enableV8SingleThreadMode(); | 511 WebScriptController::enableV8SingleThreadMode(); |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 | 1046 |
1055 scoped_refptr<base::MessageLoopProxy> | 1047 scoped_refptr<base::MessageLoopProxy> |
1056 RenderThreadImpl::GetFileThreadMessageLoopProxy() { | 1048 RenderThreadImpl::GetFileThreadMessageLoopProxy() { |
1057 DCHECK(message_loop() == MessageLoop::current()); | 1049 DCHECK(message_loop() == MessageLoop::current()); |
1058 if (!file_thread_.get()) { | 1050 if (!file_thread_.get()) { |
1059 file_thread_.reset(new base::Thread("Renderer::FILE")); | 1051 file_thread_.reset(new base::Thread("Renderer::FILE")); |
1060 file_thread_->Start(); | 1052 file_thread_->Start(); |
1061 } | 1053 } |
1062 return file_thread_->message_loop_proxy(); | 1054 return file_thread_->message_loop_proxy(); |
1063 } | 1055 } |
OLD | NEW |