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

Side by Side Diff: content/common/gpu/client/context_provider_command_buffer.h

Issue 20185002: ContextProvider in OutputSurface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: contextprovider: don't access Context3d() in OutputSurface contructors, it's not bound yet Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #ifndef CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER 5 #ifndef CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER
6 #define CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER 6 #define CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/synchronization/lock.h" 9 #include "base/synchronization/lock.h"
10 #include "base/threading/thread_checker.h" 10 #include "base/threading/thread_checker.h"
(...skipping 17 matching lines...) Expand all
28 static scoped_refptr<ContextProviderCommandBuffer> Create( 28 static scoped_refptr<ContextProviderCommandBuffer> Create(
29 const CreateCallback& create_callback); 29 const CreateCallback& create_callback);
30 30
31 virtual bool BindToCurrentThread() OVERRIDE; 31 virtual bool BindToCurrentThread() OVERRIDE;
32 virtual WebGraphicsContext3DCommandBufferImpl* Context3d() OVERRIDE; 32 virtual WebGraphicsContext3DCommandBufferImpl* Context3d() OVERRIDE;
33 virtual class GrContext* GrContext() OVERRIDE; 33 virtual class GrContext* GrContext() OVERRIDE;
34 virtual void VerifyContexts() OVERRIDE; 34 virtual void VerifyContexts() OVERRIDE;
35 virtual bool DestroyedOnMainThread() OVERRIDE; 35 virtual bool DestroyedOnMainThread() OVERRIDE;
36 virtual void SetLostContextCallback( 36 virtual void SetLostContextCallback(
37 const LostContextCallback& lost_context_callback) OVERRIDE; 37 const LostContextCallback& lost_context_callback) OVERRIDE;
38 virtual void SetSwapBuffersCompleteCallback(
39 const SwapBuffersCompleteCallback& swap_buffers_complete_callback)
40 OVERRIDE;
41 virtual void SetMemoryPolicyChangedCallback(
42 const MemoryPolicyChangedCallback& memory_policy_changed_callback)
43 OVERRIDE;
38 44
39 void set_leak_on_destroy() { 45 void set_leak_on_destroy() {
40 base::AutoLock lock(main_thread_lock_); 46 base::AutoLock lock(main_thread_lock_);
41 leak_on_destroy_ = true; 47 leak_on_destroy_ = true;
42 } 48 }
43 49
44 protected: 50 protected:
45 ContextProviderCommandBuffer(); 51 ContextProviderCommandBuffer();
46 virtual ~ContextProviderCommandBuffer(); 52 virtual ~ContextProviderCommandBuffer();
47 53
48 // This must be called immedately after creating this object, and it should 54 // This must be called immedately after creating this object, and it should
49 // be thrown away if this returns false. 55 // be thrown away if this returns false.
50 bool InitializeOnMainThread(const CreateCallback& create_callback); 56 bool InitializeOnMainThread(const CreateCallback& create_callback);
51 57
52 void OnLostContext(); 58 void OnLostContext();
53 void OnMemoryAllocationChanged(bool nonzero_allocation); 59 void OnSwapBuffersComplete();
60 void OnMemoryAllocationChanged(
61 const WebKit::WebGraphicsMemoryAllocation& allocation);
54 62
55 private: 63 private:
56 base::ThreadChecker main_thread_checker_; 64 base::ThreadChecker main_thread_checker_;
57 base::ThreadChecker context_thread_checker_; 65 base::ThreadChecker context_thread_checker_;
58 66
59 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d_; 67 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d_;
60 scoped_ptr<webkit::gpu::GrContextForWebGraphicsContext3D> gr_context_; 68 scoped_ptr<webkit::gpu::GrContextForWebGraphicsContext3D> gr_context_;
61 69
62 LostContextCallback lost_context_callback_; 70 LostContextCallback lost_context_callback_;
71 SwapBuffersCompleteCallback swap_buffers_complete_callback_;
72 MemoryPolicyChangedCallback memory_policy_changed_callback_;
63 73
64 base::Lock main_thread_lock_; 74 base::Lock main_thread_lock_;
65 bool leak_on_destroy_; 75 bool leak_on_destroy_;
66 bool destroyed_; 76 bool destroyed_;
67 77
68 class LostContextCallbackProxy; 78 class LostContextCallbackProxy;
69 scoped_ptr<LostContextCallbackProxy> lost_context_callback_proxy_; 79 scoped_ptr<LostContextCallbackProxy> lost_context_callback_proxy_;
70 80
81 class SwapBuffersCompleteCallbackProxy;
82 scoped_ptr<SwapBuffersCompleteCallbackProxy>
83 swap_buffers_complete_callback_proxy_;
84
71 class MemoryAllocationCallbackProxy; 85 class MemoryAllocationCallbackProxy;
72 scoped_ptr<MemoryAllocationCallbackProxy> memory_allocation_callback_proxy_; 86 scoped_ptr<MemoryAllocationCallbackProxy> memory_allocation_callback_proxy_;
73 }; 87 };
74 88
75 } // namespace content 89 } // namespace content
76 90
77 #endif // CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER 91 #endif // CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER
OLDNEW
« no previous file with comments | « content/browser/renderer_host/compositor_impl_android.cc ('k') | content/common/gpu/client/context_provider_command_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698