ContextProvider in OutputSurface
Instead of putting a raw WebGraphicsContext3D in the OutputSurface
given to the compositor, put a ContextProvider. This requires
embedders to create ContextProviders instead of raw contexts.
No change in behaviour. Covered by existing tests, including cc/
context loss tests.
BUG=258625
[email protected], [email protected], [email protected], [email protected]
Review URL: https://codereview.chromium.org/20185002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@217890 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/webkit/common/gpu/context_provider_in_process.h b/webkit/common/gpu/context_provider_in_process.h
index 169a1a8f..7953b30 100644
--- a/webkit/common/gpu/context_provider_in_process.h
+++ b/webkit/common/gpu/context_provider_in_process.h
@@ -10,16 +10,17 @@
#include "base/synchronization/lock.h"
#include "base/threading/thread_checker.h"
#include "cc/output/context_provider.h"
+#include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h"
#include "webkit/common/gpu/webkit_gpu_export.h"
namespace WebKit {
class WebGraphicsContext3D;
+struct WebGraphicsMemoryAllocation;
}
namespace webkit {
namespace gpu {
class GrContextForWebGraphicsContext3D;
-class WebGraphicsContext3DInProcessCommandBufferImpl;
class WEBKIT_GPU_EXPORT ContextProviderInProcess
: NON_EXPORTED_BASE(public cc::ContextProvider) {
@@ -36,12 +37,19 @@
static scoped_refptr<ContextProviderInProcess> CreateOffscreen();
virtual bool BindToCurrentThread() OVERRIDE;
- virtual WebKit::WebGraphicsContext3D* Context3d() OVERRIDE;
+ virtual webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl*
+ Context3d() OVERRIDE;
virtual class GrContext* GrContext() OVERRIDE;
virtual void VerifyContexts() OVERRIDE;
virtual bool DestroyedOnMainThread() OVERRIDE;
virtual void SetLostContextCallback(
const LostContextCallback& lost_context_callback) OVERRIDE;
+ virtual void SetSwapBuffersCompleteCallback(
+ const SwapBuffersCompleteCallback& swap_buffers_complete_callback)
+ OVERRIDE;
+ virtual void SetMemoryPolicyChangedCallback(
+ const MemoryPolicyChangedCallback& memory_policy_changed_callback)
+ OVERRIDE;
protected:
ContextProviderInProcess();
@@ -51,16 +59,21 @@
const CreateCallback& create_callback);
void OnLostContext();
- void OnMemoryAllocationChanged(bool nonzero_allocation);
+ void OnSwapBuffersComplete();
+ void OnMemoryAllocationChanged(
+ const WebKit::WebGraphicsMemoryAllocation& allocation);
private:
base::ThreadChecker main_thread_checker_;
base::ThreadChecker context_thread_checker_;
- scoped_ptr<WebKit::WebGraphicsContext3D> context3d_;
+ scoped_ptr<webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl>
+ context3d_;
scoped_ptr<webkit::gpu::GrContextForWebGraphicsContext3D> gr_context_;
LostContextCallback lost_context_callback_;
+ SwapBuffersCompleteCallback swap_buffers_complete_callback_;
+ MemoryPolicyChangedCallback memory_policy_changed_callback_;
base::Lock destroyed_lock_;
bool destroyed_;
@@ -68,6 +81,10 @@
class LostContextCallbackProxy;
scoped_ptr<LostContextCallbackProxy> lost_context_callback_proxy_;
+ class SwapBuffersCompleteCallbackProxy;
+ scoped_ptr<SwapBuffersCompleteCallbackProxy>
+ swap_buffers_complete_callback_proxy_;
+
class MemoryAllocationCallbackProxy;
scoped_ptr<MemoryAllocationCallbackProxy> memory_allocation_callback_proxy_;
};