Index: content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc |
diff --git a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc |
index 4cf413d69ed01f9fe61e3fcfb29ccc15d87fd324..bb7d4dc1ee72b5d466167f12eda713c53d052e93 100644 |
--- a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc |
+++ b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc |
@@ -151,7 +151,20 @@ WebGraphicsContext3DCommandBufferImpl::WebGraphicsContext3DCommandBufferImpl( |
transfer_buffer_(NULL), |
gl_(NULL), |
frame_number_(0), |
- bind_generates_resources_(false) { |
+ bind_generates_resources_(false), |
+ use_echo_for_swap_ack_(true) { |
+#if defined(OS_MACOSX) || defined(OS_WIN) |
+ // Get ViewMsg_SwapBuffers_ACK from browser for single-threaded path. |
darin (slow to review)
2012/08/03 21:16:06
this is exactly the same logic as in render_view_i
|
+ base::FieldTrial* trial = |
+ base::FieldTrialList::Find(content::kGpuCompositingFieldTrialName); |
+ bool thread_trial = trial && trial->group_name() == |
+ content::kGpuCompositingFieldTrialThreadEnabledName; |
+ use_echo_for_swap_ack_ = thread_trial || |
+ (CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kEnableThreadedCompositing) && |
+ !CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kDisableThreadedCompositing)); |
+#endif |
} |
WebGraphicsContext3DCommandBufferImpl:: |
@@ -521,20 +534,7 @@ void WebGraphicsContext3DCommandBufferImpl::prepareTexture() { |
if (command_buffer_->GetLastState().error == gpu::error::kNoError) |
gl_->SwapBuffers(); |
- bool use_echo_for_swap_ack = true; |
-#if defined(OS_MACOSX) || defined(OS_WIN) |
- // Get ViewMsg_SwapBuffers_ACK from browser for single-threaded path. |
- base::FieldTrial* trial = |
- base::FieldTrialList::Find(content::kGpuCompositingFieldTrialName); |
- bool thread_trial = trial && trial->group_name() == |
- content::kGpuCompositingFieldTrialThreadEnabledName; |
- use_echo_for_swap_ack = thread_trial || |
- (CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kEnableThreadedCompositing) && |
- !CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kDisableThreadedCompositing)); |
-#endif |
- if (use_echo_for_swap_ack) { |
+ if (use_echo_for_swap_ack_) { |
command_buffer_->Echo(base::Bind( |
&WebGraphicsContext3DCommandBufferImpl::OnSwapBuffersComplete, |
weak_ptr_factory_.GetWeakPtr())); |