Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: content/renderer/render_thread_impl.cc

Issue 10811002: Add threaded compositing mode to field trial (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ilya feedback Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/public/common/content_constants.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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/content_constants.h"
43 #include "content/public/common/content_paths.h" 44 #include "content/public/common/content_paths.h"
44 #include "content/public/common/content_switches.h" 45 #include "content/public/common/content_switches.h"
45 #include "content/public/common/renderer_preferences.h" 46 #include "content/public/common/renderer_preferences.h"
46 #include "content/public/common/url_constants.h" 47 #include "content/public/common/url_constants.h"
47 #include "content/public/renderer/content_renderer_client.h" 48 #include "content/public/renderer/content_renderer_client.h"
48 #include "content/public/renderer/render_process_observer.h" 49 #include "content/public/renderer/render_process_observer.h"
49 #include "content/public/renderer/render_view_visitor.h" 50 #include "content/public/renderer/render_view_visitor.h"
50 #include "content/renderer/browser_plugin/old/browser_plugin_channel_manager.h" 51 #include "content/renderer/browser_plugin/old/browser_plugin_channel_manager.h"
51 #include "content/renderer/browser_plugin/old/browser_plugin_registry.h" 52 #include "content/renderer/browser_plugin/old/browser_plugin_registry.h"
52 #include "content/renderer/devtools_agent_filter.h" 53 #include "content/renderer/devtools_agent_filter.h"
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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;
495 bool has_enable = CommandLine::ForCurrentProcess()->HasSwitch( 500 bool has_enable = CommandLine::ForCurrentProcess()->HasSwitch(
496 switches::kEnableThreadedCompositing); 501 switches::kEnableThreadedCompositing);
497 bool has_disable = CommandLine::ForCurrentProcess()->HasSwitch( 502 bool has_disable = CommandLine::ForCurrentProcess()->HasSwitch(
498 switches::kDisableThreadedCompositing); 503 switches::kDisableThreadedCompositing);
499 // TODO(fsamuel): Guests don't currently support threaded compositing. 504 // TODO(fsamuel): Guests don't currently support threaded compositing.
500 // This should go away with the new design of the browser plugin. 505 // This should go away with the new design of the browser plugin.
501 // The new design can be tracked at: http://crbug.com/134492. 506 // The new design can be tracked at: http://crbug.com/134492.
502 bool is_guest = CommandLine::ForCurrentProcess()->HasSwitch( 507 bool is_guest = CommandLine::ForCurrentProcess()->HasSwitch(
503 switches::kGuestRenderer); 508 switches::kGuestRenderer);
504 bool enable = has_enable && (!has_disable) && (!is_guest); 509 DCHECK(!is_thread_trial || !has_disable);
510 bool enable = (is_thread_trial || (has_enable && !has_disable)) && !is_guest;
505 if (enable) { 511 if (enable) {
506 compositor_thread_.reset(new CompositorThread(this)); 512 compositor_thread_.reset(new CompositorThread(this));
507 AddFilter(compositor_thread_->GetMessageFilter()); 513 AddFilter(compositor_thread_->GetMessageFilter());
508 WebKit::WebCompositor::initialize(compositor_thread_->GetWebThread()); 514 WebKit::WebCompositor::initialize(compositor_thread_->GetWebThread());
509 } else 515 } else {
510 WebKit::WebCompositor::initialize(NULL); 516 WebKit::WebCompositor::initialize(NULL);
517 }
511 compositor_initialized_ = true; 518 compositor_initialized_ = true;
512 519
513 WebScriptController::enableV8SingleThreadMode(); 520 WebScriptController::enableV8SingleThreadMode();
514 521
515 RenderThreadImpl::RegisterSchemes(); 522 RenderThreadImpl::RegisterSchemes();
516 523
517 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 524 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
518 525
519 webkit_glue::EnableWebCoreLogChannels( 526 webkit_glue::EnableWebCoreLogChannels(
520 command_line.GetSwitchValueASCII(switches::kWebCoreLogChannels)); 527 command_line.GetSwitchValueASCII(switches::kWebCoreLogChannels));
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 1051
1045 scoped_refptr<base::MessageLoopProxy> 1052 scoped_refptr<base::MessageLoopProxy>
1046 RenderThreadImpl::GetFileThreadMessageLoopProxy() { 1053 RenderThreadImpl::GetFileThreadMessageLoopProxy() {
1047 DCHECK(message_loop() == MessageLoop::current()); 1054 DCHECK(message_loop() == MessageLoop::current());
1048 if (!file_thread_.get()) { 1055 if (!file_thread_.get()) {
1049 file_thread_.reset(new base::Thread("Renderer::FILE")); 1056 file_thread_.reset(new base::Thread("Renderer::FILE"));
1050 file_thread_->Start(); 1057 file_thread_->Start();
1051 } 1058 }
1052 return file_thread_->message_loop_proxy(); 1059 return file_thread_->message_loop_proxy();
1053 } 1060 }
OLDNEW
« no previous file with comments | « content/public/common/content_constants.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698