| Index: ui/compositor/test/in_process_context_provider.cc
|
| diff --git a/webkit/common/gpu/context_provider_in_process.cc b/ui/compositor/test/in_process_context_provider.cc
|
| similarity index 74%
|
| copy from webkit/common/gpu/context_provider_in_process.cc
|
| copy to ui/compositor/test/in_process_context_provider.cc
|
| index a12493c85996b80743acac9535c9d4c3f0092199..6d8bbfb87947faa594b8cf69585c96e2934af866 100644
|
| --- a/webkit/common/gpu/context_provider_in_process.cc
|
| +++ b/ui/compositor/test/in_process_context_provider.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "webkit/common/gpu/context_provider_in_process.h"
|
| +#include "ui/compositor/test/in_process_context_provider.h"
|
|
|
| #include <set>
|
|
|
| @@ -12,17 +12,16 @@
|
| #include "cc/output/managed_memory_policy.h"
|
| #include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h"
|
| #include "gpu/command_buffer/client/gles2_implementation.h"
|
| -#include "webkit/common/gpu/grcontext_for_webgraphicscontext3d.h"
|
| +#include "ui/compositor/test/grcontext_for_webgraphicscontext3d.h"
|
|
|
| using gpu_blink::WebGraphicsContext3DInProcessCommandBufferImpl;
|
|
|
| -namespace webkit {
|
| -namespace gpu {
|
| +namespace ui {
|
|
|
| -class ContextProviderInProcess::LostContextCallbackProxy
|
| +class InProcessContextProvider::LostContextCallbackProxy
|
| : public blink::WebGraphicsContext3D::WebGraphicsContextLostCallback {
|
| public:
|
| - explicit LostContextCallbackProxy(ContextProviderInProcess* provider)
|
| + explicit LostContextCallbackProxy(InProcessContextProvider* provider)
|
| : provider_(provider) {
|
| provider_->context3d_->setContextLostCallback(this);
|
| }
|
| @@ -36,21 +35,21 @@ class ContextProviderInProcess::LostContextCallbackProxy
|
| }
|
|
|
| private:
|
| - ContextProviderInProcess* provider_;
|
| + InProcessContextProvider* provider_;
|
| };
|
|
|
| // static
|
| -scoped_refptr<ContextProviderInProcess> ContextProviderInProcess::Create(
|
| +scoped_refptr<InProcessContextProvider> InProcessContextProvider::Create(
|
| scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d,
|
| const std::string& debug_name) {
|
| if (!context3d)
|
| return NULL;
|
| - return new ContextProviderInProcess(context3d.Pass(), debug_name);
|
| + return new InProcessContextProvider(context3d.Pass(), debug_name);
|
| }
|
|
|
| // static
|
| -scoped_refptr<ContextProviderInProcess>
|
| -ContextProviderInProcess::CreateOffscreen(
|
| +scoped_refptr<InProcessContextProvider>
|
| +InProcessContextProvider::CreateOffscreen(
|
| bool lose_context_when_out_of_memory) {
|
| blink::WebGraphicsContext3D::Attributes attributes;
|
| attributes.depth = false;
|
| @@ -65,7 +64,7 @@ ContextProviderInProcess::CreateOffscreen(
|
| "Offscreen");
|
| }
|
|
|
| -ContextProviderInProcess::ContextProviderInProcess(
|
| +InProcessContextProvider::InProcessContextProvider(
|
| scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d,
|
| const std::string& debug_name)
|
| : context3d_(context3d.Pass()),
|
| @@ -76,19 +75,12 @@ ContextProviderInProcess::ContextProviderInProcess(
|
| context_thread_checker_.DetachFromThread();
|
| }
|
|
|
| -ContextProviderInProcess::~ContextProviderInProcess() {
|
| +InProcessContextProvider::~InProcessContextProvider() {
|
| DCHECK(main_thread_checker_.CalledOnValidThread() ||
|
| context_thread_checker_.CalledOnValidThread());
|
| }
|
|
|
| -blink::WebGraphicsContext3D* ContextProviderInProcess::WebContext3D() {
|
| - DCHECK(lost_context_callback_proxy_); // Is bound to thread.
|
| - DCHECK(context_thread_checker_.CalledOnValidThread());
|
| -
|
| - return context3d_.get();
|
| -}
|
| -
|
| -bool ContextProviderInProcess::BindToCurrentThread() {
|
| +bool InProcessContextProvider::BindToCurrentThread() {
|
| DCHECK(context3d_);
|
|
|
| // This is called on the thread the context will be used.
|
| @@ -111,7 +103,7 @@ bool ContextProviderInProcess::BindToCurrentThread() {
|
| return true;
|
| }
|
|
|
| -void ContextProviderInProcess::InitializeCapabilities() {
|
| +void InProcessContextProvider::InitializeCapabilities() {
|
| capabilities_.gpu = context3d_->GetImplementation()->capabilities();
|
|
|
| size_t mapped_memory_limit = context3d_->GetMappedMemoryLimit();
|
| @@ -123,13 +115,13 @@ void ContextProviderInProcess::InitializeCapabilities() {
|
| }
|
|
|
| cc::ContextProvider::Capabilities
|
| -ContextProviderInProcess::ContextCapabilities() {
|
| +InProcessContextProvider::ContextCapabilities() {
|
| DCHECK(lost_context_callback_proxy_); // Is bound to thread.
|
| DCHECK(context_thread_checker_.CalledOnValidThread());
|
| return capabilities_;
|
| }
|
|
|
| -::gpu::gles2::GLES2Interface* ContextProviderInProcess::ContextGL() {
|
| +::gpu::gles2::GLES2Interface* InProcessContextProvider::ContextGL() {
|
| DCHECK(context3d_);
|
| DCHECK(lost_context_callback_proxy_); // Is bound to thread.
|
| DCHECK(context_thread_checker_.CalledOnValidThread());
|
| @@ -137,7 +129,7 @@ ContextProviderInProcess::ContextCapabilities() {
|
| return context3d_->GetGLInterface();
|
| }
|
|
|
| -::gpu::ContextSupport* ContextProviderInProcess::ContextSupport() {
|
| +::gpu::ContextSupport* InProcessContextProvider::ContextSupport() {
|
| DCHECK(context3d_);
|
| if (!lost_context_callback_proxy_)
|
| return NULL; // Not bound to anything.
|
| @@ -147,25 +139,25 @@ ContextProviderInProcess::ContextCapabilities() {
|
| return context3d_->GetContextSupport();
|
| }
|
|
|
| -class GrContext* ContextProviderInProcess::GrContext() {
|
| +class GrContext* InProcessContextProvider::GrContext() {
|
| DCHECK(lost_context_callback_proxy_); // Is bound to thread.
|
| DCHECK(context_thread_checker_.CalledOnValidThread());
|
|
|
| if (gr_context_)
|
| - return gr_context_->get();
|
| + return gr_context_->context();
|
|
|
| gr_context_.reset(new GrContextForWebGraphicsContext3D(context3d_.get()));
|
| - return gr_context_->get();
|
| + return gr_context_->context();
|
| }
|
|
|
| -bool ContextProviderInProcess::IsContextLost() {
|
| +bool InProcessContextProvider::IsContextLost() {
|
| DCHECK(lost_context_callback_proxy_); // Is bound to thread.
|
| DCHECK(context_thread_checker_.CalledOnValidThread());
|
|
|
| return context3d_->isContextLost();
|
| }
|
|
|
| -void ContextProviderInProcess::VerifyContexts() {
|
| +void InProcessContextProvider::VerifyContexts() {
|
| DCHECK(lost_context_callback_proxy_); // Is bound to thread.
|
| DCHECK(context_thread_checker_.CalledOnValidThread());
|
|
|
| @@ -173,14 +165,14 @@ void ContextProviderInProcess::VerifyContexts() {
|
| OnLostContext();
|
| }
|
|
|
| -void ContextProviderInProcess::DeleteCachedResources() {
|
| +void InProcessContextProvider::DeleteCachedResources() {
|
| DCHECK(context_thread_checker_.CalledOnValidThread());
|
|
|
| if (gr_context_)
|
| gr_context_->FreeGpuResources();
|
| }
|
|
|
| -void ContextProviderInProcess::OnLostContext() {
|
| +void InProcessContextProvider::OnLostContext() {
|
| DCHECK(context_thread_checker_.CalledOnValidThread());
|
| {
|
| base::AutoLock lock(destroyed_lock_);
|
| @@ -194,14 +186,14 @@ void ContextProviderInProcess::OnLostContext() {
|
| gr_context_->OnLostContext();
|
| }
|
|
|
| -bool ContextProviderInProcess::DestroyedOnMainThread() {
|
| +bool InProcessContextProvider::DestroyedOnMainThread() {
|
| DCHECK(main_thread_checker_.CalledOnValidThread());
|
|
|
| base::AutoLock lock(destroyed_lock_);
|
| return destroyed_;
|
| }
|
|
|
| -void ContextProviderInProcess::SetLostContextCallback(
|
| +void InProcessContextProvider::SetLostContextCallback(
|
| const LostContextCallback& lost_context_callback) {
|
| DCHECK(context_thread_checker_.CalledOnValidThread());
|
| DCHECK(lost_context_callback_.is_null() ||
|
| @@ -209,10 +201,9 @@ void ContextProviderInProcess::SetLostContextCallback(
|
| lost_context_callback_ = lost_context_callback;
|
| }
|
|
|
| -void ContextProviderInProcess::SetMemoryPolicyChangedCallback(
|
| +void InProcessContextProvider::SetMemoryPolicyChangedCallback(
|
| const MemoryPolicyChangedCallback& memory_policy_changed_callback) {
|
| // There's no memory manager for the in-process implementation.
|
| }
|
|
|
| -} // namespace gpu
|
| -} // namespace webkit
|
| +} // namespace ui
|
|
|