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..6c42c077d5f2e3afe22203c61c4965f2b39176ce 100644 |
--- a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc |
+++ b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc |
@@ -26,6 +26,7 @@ |
#include "content/common/gpu/gpu_memory_allocation.h" |
#include "content/common/gpu/client/gpu_channel_host.h" |
#include "content/common/gpu/gpu_process_launch_causes.h" |
+#include "content/public/common/compositor_util.h" |
#include "content/public/common/content_constants.h" |
#include "content/public/common/content_switches.h" |
#include "gpu/command_buffer/client/gles2_cmd_helper.h" |
@@ -151,7 +152,12 @@ 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. |
+ use_echo_for_swap_ack_ = content::IsThreadedCompositingEnabled(); |
+#endif |
} |
WebGraphicsContext3DCommandBufferImpl:: |
@@ -521,20 +527,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())); |