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

Side by Side Diff: content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc

Issue 10824168: Cleaning up compositing field trial code and enable FCM in beta/stable (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: compositor_utils.cc moved to content\common Created 8 years, 4 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
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/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" 5 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
6 6
7 #include "third_party/khronos/GLES2/gl2.h" 7 #include "third_party/khronos/GLES2/gl2.h"
8 #ifndef GL_GLEXT_PROTOTYPES 8 #ifndef GL_GLEXT_PROTOTYPES
9 #define GL_GLEXT_PROTOTYPES 1 9 #define GL_GLEXT_PROTOTYPES 1
10 #endif 10 #endif
11 #include "third_party/khronos/GLES2/gl2ext.h" 11 #include "third_party/khronos/GLES2/gl2ext.h"
12 12
13 #include <algorithm> 13 #include <algorithm>
14 #include <set> 14 #include <set>
15 15
16 #include "base/bind.h" 16 #include "base/bind.h"
17 #include "base/lazy_instance.h" 17 #include "base/lazy_instance.h"
18 #include "base/string_tokenizer.h" 18 #include "base/string_tokenizer.h"
19 #include "base/command_line.h" 19 #include "base/command_line.h"
20 #include "base/debug/trace_event.h" 20 #include "base/debug/trace_event.h"
21 #include "base/logging.h" 21 #include "base/logging.h"
22 #include "base/message_loop.h" 22 #include "base/message_loop.h"
23 #include "base/metrics/field_trial.h" 23 #include "base/metrics/field_trial.h"
24 #include "base/metrics/histogram.h" 24 #include "base/metrics/histogram.h"
25 #include "base/synchronization/lock.h" 25 #include "base/synchronization/lock.h"
26 #include "content/common/gpu/gpu_memory_allocation.h" 26 #include "content/common/gpu/gpu_memory_allocation.h"
27 #include "content/common/gpu/client/gpu_channel_host.h" 27 #include "content/common/gpu/client/gpu_channel_host.h"
28 #include "content/common/gpu/gpu_process_launch_causes.h" 28 #include "content/common/gpu/gpu_process_launch_causes.h"
29 #include "content/public/common/compositor_util.h"
29 #include "content/public/common/content_constants.h" 30 #include "content/public/common/content_constants.h"
30 #include "content/public/common/content_switches.h" 31 #include "content/public/common/content_switches.h"
31 #include "gpu/command_buffer/client/gles2_cmd_helper.h" 32 #include "gpu/command_buffer/client/gles2_cmd_helper.h"
32 #include "gpu/command_buffer/client/gles2_implementation.h" 33 #include "gpu/command_buffer/client/gles2_implementation.h"
33 #include "gpu/command_buffer/client/gles2_lib.h" 34 #include "gpu/command_buffer/client/gles2_lib.h"
34 #include "gpu/command_buffer/client/transfer_buffer.h" 35 #include "gpu/command_buffer/client/transfer_buffer.h"
35 #include "gpu/command_buffer/common/constants.h" 36 #include "gpu/command_buffer/common/constants.h"
36 #include "gpu/ipc/command_buffer_proxy.h" 37 #include "gpu/ipc/command_buffer_proxy.h"
37 #include "webkit/glue/gl_bindings_skia_cmd_buffer.h" 38 #include "webkit/glue/gl_bindings_skia_cmd_buffer.h"
38 39
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 bound_fbo_(0), 145 bound_fbo_(0),
145 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), 146 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
146 initialized_(false), 147 initialized_(false),
147 parent_(NULL), 148 parent_(NULL),
148 parent_texture_id_(0), 149 parent_texture_id_(0),
149 command_buffer_(NULL), 150 command_buffer_(NULL),
150 gles2_helper_(NULL), 151 gles2_helper_(NULL),
151 transfer_buffer_(NULL), 152 transfer_buffer_(NULL),
152 gl_(NULL), 153 gl_(NULL),
153 frame_number_(0), 154 frame_number_(0),
154 bind_generates_resources_(false) { 155 bind_generates_resources_(false),
156 use_echo_for_swap_ack_(true) {
157 #if defined(OS_MACOSX) || defined(OS_WIN)
158 // Get ViewMsg_SwapBuffers_ACK from browser for single-threaded path.
159 use_echo_for_swap_ack_ = content::IsThreadedCompositingEnabled();
160 #endif
155 } 161 }
156 162
157 WebGraphicsContext3DCommandBufferImpl:: 163 WebGraphicsContext3DCommandBufferImpl::
158 ~WebGraphicsContext3DCommandBufferImpl() { 164 ~WebGraphicsContext3DCommandBufferImpl() {
159 if (gl_) { 165 if (gl_) {
160 gl_->SetErrorMessageCallback(NULL); 166 gl_->SetErrorMessageCallback(NULL);
161 } 167 }
162 168
163 { 169 {
164 base::AutoLock lock(g_all_shared_contexts_lock.Get()); 170 base::AutoLock lock(g_all_shared_contexts_lock.Get());
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 "frame", frame_number_); 520 "frame", frame_number_);
515 frame_number_++; 521 frame_number_++;
516 // Copies the contents of the off-screen render target into the texture 522 // Copies the contents of the off-screen render target into the texture
517 // used by the compositor. 523 // used by the compositor.
518 if (ShouldUseSwapClient()) 524 if (ShouldUseSwapClient())
519 swap_client_->OnViewContextSwapBuffersPosted(); 525 swap_client_->OnViewContextSwapBuffersPosted();
520 526
521 if (command_buffer_->GetLastState().error == gpu::error::kNoError) 527 if (command_buffer_->GetLastState().error == gpu::error::kNoError)
522 gl_->SwapBuffers(); 528 gl_->SwapBuffers();
523 529
524 bool use_echo_for_swap_ack = true; 530 if (use_echo_for_swap_ack_) {
525 #if defined(OS_MACOSX) || defined(OS_WIN)
526 // Get ViewMsg_SwapBuffers_ACK from browser for single-threaded path.
527 base::FieldTrial* trial =
528 base::FieldTrialList::Find(content::kGpuCompositingFieldTrialName);
529 bool thread_trial = trial && trial->group_name() ==
530 content::kGpuCompositingFieldTrialThreadEnabledName;
531 use_echo_for_swap_ack = thread_trial ||
532 (CommandLine::ForCurrentProcess()->HasSwitch(
533 switches::kEnableThreadedCompositing) &&
534 !CommandLine::ForCurrentProcess()->HasSwitch(
535 switches::kDisableThreadedCompositing));
536 #endif
537 if (use_echo_for_swap_ack) {
538 command_buffer_->Echo(base::Bind( 531 command_buffer_->Echo(base::Bind(
539 &WebGraphicsContext3DCommandBufferImpl::OnSwapBuffersComplete, 532 &WebGraphicsContext3DCommandBufferImpl::OnSwapBuffersComplete,
540 weak_ptr_factory_.GetWeakPtr())); 533 weak_ptr_factory_.GetWeakPtr()));
541 } 534 }
542 #if defined(OS_MACOSX) 535 #if defined(OS_MACOSX)
543 // It appears that making the compositor's on-screen context current on 536 // It appears that making the compositor's on-screen context current on
544 // other platforms implies this flush. TODO(kbr): this means that the 537 // other platforms implies this flush. TODO(kbr): this means that the
545 // TOUCH build and, in the future, other platforms might need this. 538 // TOUCH build and, in the future, other platforms might need this.
546 gl_->Flush(); 539 gl_->Flush();
547 #endif 540 #endif
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after
1570 swap_client_->OnViewContextSwapBuffersAborted(); 1563 swap_client_->OnViewContextSwapBuffersAborted();
1571 } 1564 }
1572 1565
1573 void WebGraphicsContext3DCommandBufferImpl::OnErrorMessage( 1566 void WebGraphicsContext3DCommandBufferImpl::OnErrorMessage(
1574 const std::string& message, int id) { 1567 const std::string& message, int id) {
1575 if (error_message_callback_) { 1568 if (error_message_callback_) {
1576 WebKit::WebString str = WebKit::WebString::fromUTF8(message.c_str()); 1569 WebKit::WebString str = WebKit::WebString::fromUTF8(message.c_str());
1577 error_message_callback_->onErrorMessage(str, id); 1570 error_message_callback_->onErrorMessage(str, id);
1578 } 1571 }
1579 } 1572 }
OLDNEW
« no previous file with comments | « content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h ('k') | content/content_common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698