diff options
author | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-13 06:56:27 +0000 |
---|---|---|
committer | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-13 06:56:27 +0000 |
commit | af13d837d964699263fac053de1b6bafce3e6978 (patch) | |
tree | 721122ada9f3c26e2a36545e699a1ff90a8c67d8 /webkit/common | |
parent | 1ccbac171ae3c0c0413ed8ce88100e9b3159df72 (diff) | |
download | chromium_src-af13d837d964699263fac053de1b6bafce3e6978.zip chromium_src-af13d837d964699263fac053de1b6bafce3e6978.tar.gz chromium_src-af13d837d964699263fac053de1b6bafce3e6978.tar.bz2 |
Move context labelling logic out to ContextProviders
This moves the context debug labelling logic out to ContextProviders instead of doing it inside cc with a setting. This cuts down on the configuration surface area for cc, allows a bit more flexibility in labelling, and reduces DelegatingRenderer's direct dependencies on WebGraphicsContext3D.
Review URL: https://chromiumcodereview.appspot.com/23629035
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@222990 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/common')
-rw-r--r-- | webkit/common/gpu/context_provider_in_process.cc | 18 | ||||
-rw-r--r-- | webkit/common/gpu/context_provider_in_process.h | 7 |
2 files changed, 18 insertions, 7 deletions
diff --git a/webkit/common/gpu/context_provider_in_process.cc b/webkit/common/gpu/context_provider_in_process.cc index 8ec17f4..9c31539 100644 --- a/webkit/common/gpu/context_provider_in_process.cc +++ b/webkit/common/gpu/context_provider_in_process.cc @@ -6,6 +6,7 @@ #include "base/bind.h" #include "base/callback_helpers.h" +#include "base/strings/stringprintf.h" #include "cc/output/managed_memory_policy.h" #include "webkit/common/gpu/grcontext_for_webgraphicscontext3d.h" #include "webkit/common/gpu/managed_memory_policy_convert.h" @@ -78,10 +79,11 @@ class ContextProviderInProcess::MemoryAllocationCallbackProxy // static scoped_refptr<ContextProviderInProcess> ContextProviderInProcess::Create( - scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d) { + scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d, + const std::string& debug_name) { if (!context3d) return NULL; - return new ContextProviderInProcess(context3d.Pass()); + return new ContextProviderInProcess(context3d.Pass(), debug_name); } // static @@ -96,13 +98,15 @@ ContextProviderInProcess::CreateOffscreen() { return Create( WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext( - attributes)); + attributes), "Offscreen"); } ContextProviderInProcess::ContextProviderInProcess( - scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d) + scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d, + const std::string& debug_name) : context3d_(context3d.Pass()), - destroyed_(false) { + destroyed_(false), + debug_name_(debug_name) { DCHECK(main_thread_checker_.CalledOnValidThread()); DCHECK(context3d_); context_thread_checker_.DetachFromThread(); @@ -125,6 +129,10 @@ bool ContextProviderInProcess::BindToCurrentThread() { if (!context3d_->makeContextCurrent()) return false; + std::string unique_context_name = + base::StringPrintf("%s-%p", debug_name_.c_str(), context3d_.get()); + context3d_->pushGroupMarkerEXT(unique_context_name.c_str()); + lost_context_callback_proxy_.reset(new LostContextCallbackProxy(this)); swap_buffers_complete_callback_proxy_.reset( new SwapBuffersCompleteCallbackProxy(this)); diff --git a/webkit/common/gpu/context_provider_in_process.h b/webkit/common/gpu/context_provider_in_process.h index 5285f7b..90c5e69 100644 --- a/webkit/common/gpu/context_provider_in_process.h +++ b/webkit/common/gpu/context_provider_in_process.h @@ -26,7 +26,8 @@ class WEBKIT_GPU_EXPORT ContextProviderInProcess : NON_EXPORTED_BASE(public cc::ContextProvider) { public: static scoped_refptr<ContextProviderInProcess> Create( - scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d); + scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d, + const std::string& debug_name); // Calls Create() with a default factory method for creating an offscreen // context. @@ -49,7 +50,8 @@ class WEBKIT_GPU_EXPORT ContextProviderInProcess protected: ContextProviderInProcess( - scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d); + scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d, + const std::string& debug_name); virtual ~ContextProviderInProcess(); void OnLostContext(); @@ -72,6 +74,7 @@ class WEBKIT_GPU_EXPORT ContextProviderInProcess base::Lock destroyed_lock_; bool destroyed_; + std::string debug_name_; class LostContextCallbackProxy; scoped_ptr<LostContextCallbackProxy> lost_context_callback_proxy_; |