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

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

Issue 337783002: Remove EnableThreadedCompositing from the browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: thread: . Created 6 years, 6 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/renderer/render_widget.h ('k') | content/shell/app/shell_main_delegate.cc » ('j') | 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_widget.h" 5 #include "content/renderer/render_widget.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 ui::TextInputMode ConvertInputMode(const blink::WebString& input_mode) { 141 ui::TextInputMode ConvertInputMode(const blink::WebString& input_mode) {
142 static TextInputModeMapSingleton* singleton = 142 static TextInputModeMapSingleton* singleton =
143 TextInputModeMapSingleton::GetInstance(); 143 TextInputModeMapSingleton::GetInstance();
144 TextInputModeMap::const_iterator it = 144 TextInputModeMap::const_iterator it =
145 singleton->map().find(input_mode.utf8()); 145 singleton->map().find(input_mode.utf8());
146 if (it == singleton->map().end()) 146 if (it == singleton->map().end())
147 return ui::TEXT_INPUT_MODE_DEFAULT; 147 return ui::TEXT_INPUT_MODE_DEFAULT;
148 return it->second; 148 return it->second;
149 } 149 }
150 150
151 bool IsThreadedCompositingEnabled() {
152 RenderThreadImpl* impl = content::RenderThreadImpl::current();
153 return !impl || !!impl->compositor_message_loop_proxy().get();
piman 2014/06/13 22:07:18 I think it should be impl && !!impl->compositor_me
154 }
155
151 // TODO(brianderson): Replace the hard-coded threshold with a fraction of 156 // TODO(brianderson): Replace the hard-coded threshold with a fraction of
152 // the BeginMainFrame interval. 157 // the BeginMainFrame interval.
153 // 4166us will allow 1/4 of a 60Hz interval or 1/2 of a 120Hz interval to 158 // 4166us will allow 1/4 of a 60Hz interval or 1/2 of a 120Hz interval to
154 // be spent in input hanlders before input starts getting throttled. 159 // be spent in input hanlders before input starts getting throttled.
155 const int kInputHandlingTimeThrottlingThresholdMicroseconds = 4166; 160 const int kInputHandlingTimeThrottlingThresholdMicroseconds = 4166;
156 161
157 } // namespace 162 } // namespace
158 163
159 namespace content { 164 namespace content {
160 165
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 is_swapped_out_(swapped_out), 386 is_swapped_out_(swapped_out),
382 input_method_is_active_(false), 387 input_method_is_active_(false),
383 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), 388 text_input_type_(ui::TEXT_INPUT_TYPE_NONE),
384 text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT), 389 text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT),
385 can_compose_inline_(true), 390 can_compose_inline_(true),
386 popup_type_(popup_type), 391 popup_type_(popup_type),
387 pending_window_rect_count_(0), 392 pending_window_rect_count_(0),
388 suppress_next_char_events_(false), 393 suppress_next_char_events_(false),
389 screen_info_(screen_info), 394 screen_info_(screen_info),
390 device_scale_factor_(screen_info_.deviceScaleFactor), 395 device_scale_factor_(screen_info_.deviceScaleFactor),
391 is_threaded_compositing_enabled_(false),
392 current_event_latency_info_(NULL), 396 current_event_latency_info_(NULL),
393 next_output_surface_id_(0), 397 next_output_surface_id_(0),
394 #if defined(OS_ANDROID) 398 #if defined(OS_ANDROID)
395 text_field_is_dirty_(false), 399 text_field_is_dirty_(false),
396 outstanding_ime_acks_(0), 400 outstanding_ime_acks_(0),
397 body_background_color_(SK_ColorWHITE), 401 body_background_color_(SK_ColorWHITE),
398 #endif 402 #endif
399 popup_origin_scale_for_emulation_(0.f), 403 popup_origin_scale_for_emulation_(0.f),
400 resizing_mode_selector_(new ResizingModeSelector()), 404 resizing_mode_selector_(new ResizingModeSelector()),
401 context_menu_source_type_(ui::MENU_SOURCE_MOUSE) { 405 context_menu_source_type_(ui::MENU_SOURCE_MOUSE) {
402 if (!swapped_out) 406 if (!swapped_out)
403 RenderProcess::current()->AddRefProcess(); 407 RenderProcess::current()->AddRefProcess();
404 DCHECK(RenderThread::Get()); 408 DCHECK(RenderThread::Get());
405 is_threaded_compositing_enabled_ =
406 CommandLine::ForCurrentProcess()->HasSwitch(
407 switches::kEnableThreadedCompositing);
408 } 409 }
409 410
410 RenderWidget::~RenderWidget() { 411 RenderWidget::~RenderWidget() {
411 DCHECK(!webwidget_) << "Leaking our WebWidget!"; 412 DCHECK(!webwidget_) << "Leaking our WebWidget!";
412 413
413 // If we are swapped out, we have released already. 414 // If we are swapped out, we have released already.
414 if (!is_swapped_out_ && RenderProcess::current()) 415 if (!is_swapped_out_ && RenderProcess::current())
415 RenderProcess::current()->ReleaseProcess(); 416 RenderProcess::current()->ReleaseProcess();
416 } 417 }
417 418
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 context_provider = ContextProviderCommandBuffer::Create( 827 context_provider = ContextProviderCommandBuffer::Create(
827 CreateGraphicsContext3D(), "RenderCompositor"); 828 CreateGraphicsContext3D(), "RenderCompositor");
828 if (!context_provider.get()) { 829 if (!context_provider.get()) {
829 // Cause the compositor to wait and try again. 830 // Cause the compositor to wait and try again.
830 return scoped_ptr<cc::OutputSurface>(); 831 return scoped_ptr<cc::OutputSurface>();
831 } 832 }
832 } 833 }
833 834
834 uint32 output_surface_id = next_output_surface_id_++; 835 uint32 output_surface_id = next_output_surface_id_++;
835 if (command_line.HasSwitch(switches::kEnableDelegatedRenderer)) { 836 if (command_line.HasSwitch(switches::kEnableDelegatedRenderer)) {
836 DCHECK(is_threaded_compositing_enabled_); 837 DCHECK(IsThreadedCompositingEnabled());
837 return scoped_ptr<cc::OutputSurface>( 838 return scoped_ptr<cc::OutputSurface>(
838 new DelegatedCompositorOutputSurface( 839 new DelegatedCompositorOutputSurface(
839 routing_id(), 840 routing_id(),
840 output_surface_id, 841 output_surface_id,
841 context_provider)); 842 context_provider));
842 } 843 }
843 if (!context_provider.get()) { 844 if (!context_provider.get()) {
844 scoped_ptr<cc::SoftwareOutputDevice> software_device( 845 scoped_ptr<cc::SoftwareOutputDevice> software_device(
845 new CompositorSoftwareOutputDevice()); 846 new CompositorSoftwareOutputDevice());
846 847
847 return scoped_ptr<cc::OutputSurface>(new CompositorOutputSurface( 848 return scoped_ptr<cc::OutputSurface>(new CompositorOutputSurface(
848 routing_id(), 849 routing_id(),
849 output_surface_id, 850 output_surface_id,
850 NULL, 851 NULL,
851 software_device.Pass(), 852 software_device.Pass(),
852 true)); 853 true));
853 } 854 }
854 855
855 if (command_line.HasSwitch(cc::switches::kCompositeToMailbox)) { 856 if (command_line.HasSwitch(cc::switches::kCompositeToMailbox)) {
856 // Composite-to-mailbox is currently used for layout tests in order to cause 857 // Composite-to-mailbox is currently used for layout tests in order to cause
857 // them to draw inside in the renderer to do the readback there. This should 858 // them to draw inside in the renderer to do the readback there. This should
858 // no longer be the case when crbug.com/311404 is fixed. 859 // no longer be the case when crbug.com/311404 is fixed.
859 DCHECK(is_threaded_compositing_enabled_ || 860 DCHECK(IsThreadedCompositingEnabled() ||
860 RenderThreadImpl::current()->layout_test_mode()); 861 RenderThreadImpl::current()->layout_test_mode());
861 cc::ResourceFormat format = cc::RGBA_8888; 862 cc::ResourceFormat format = cc::RGBA_8888;
862 #if defined(OS_ANDROID) 863 #if defined(OS_ANDROID)
863 if (base::android::SysUtils::IsLowEndDevice()) 864 if (base::android::SysUtils::IsLowEndDevice())
864 format = cc::RGB_565; 865 format = cc::RGB_565;
865 #endif 866 #endif
866 return scoped_ptr<cc::OutputSurface>( 867 return scoped_ptr<cc::OutputSurface>(
867 new MailboxOutputSurface( 868 new MailboxOutputSurface(
868 routing_id(), 869 routing_id(),
869 output_surface_id, 870 output_surface_id,
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
1160 } 1161 }
1161 1162
1162 void RenderWidget::AutoResizeCompositor() { 1163 void RenderWidget::AutoResizeCompositor() {
1163 physical_backing_size_ = gfx::ToCeiledSize(gfx::ScaleSize(size_, 1164 physical_backing_size_ = gfx::ToCeiledSize(gfx::ScaleSize(size_,
1164 device_scale_factor_)); 1165 device_scale_factor_));
1165 if (compositor_) 1166 if (compositor_)
1166 compositor_->setViewportSize(size_, physical_backing_size_); 1167 compositor_->setViewportSize(size_, physical_backing_size_);
1167 } 1168 }
1168 1169
1169 void RenderWidget::initializeLayerTreeView() { 1170 void RenderWidget::initializeLayerTreeView() {
1170 compositor_ = RenderWidgetCompositor::Create( 1171 compositor_ =
1171 this, is_threaded_compositing_enabled_); 1172 RenderWidgetCompositor::Create(this, IsThreadedCompositingEnabled());
1172 compositor_->setViewportSize(size_, physical_backing_size_); 1173 compositor_->setViewportSize(size_, physical_backing_size_);
1173 if (init_complete_) 1174 if (init_complete_)
1174 StartCompositor(); 1175 StartCompositor();
1175 } 1176 }
1176 1177
1177 blink::WebLayerTreeView* RenderWidget::layerTreeView() { 1178 blink::WebLayerTreeView* RenderWidget::layerTreeView() {
1178 return compositor_.get(); 1179 return compositor_.get();
1179 } 1180 }
1180 1181
1181 void RenderWidget::suppressCompositorScheduling(bool enable) { 1182 void RenderWidget::suppressCompositorScheduling(bool enable) {
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after
2070 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { 2071 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) {
2071 video_hole_frames_.AddObserver(frame); 2072 video_hole_frames_.AddObserver(frame);
2072 } 2073 }
2073 2074
2074 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { 2075 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) {
2075 video_hole_frames_.RemoveObserver(frame); 2076 video_hole_frames_.RemoveObserver(frame);
2076 } 2077 }
2077 #endif // defined(VIDEO_HOLE) 2078 #endif // defined(VIDEO_HOLE)
2078 2079
2079 } // namespace content 2080 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_widget.h ('k') | content/shell/app/shell_main_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698