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

Side by Side Diff: webkit/common/gpu/context_provider_in_process.h

Issue 23072008: aura: Allow in process ContextProvider to hold onscreen contexts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « ui/compositor/compositor.cc ('k') | webkit/common/gpu/context_provider_in_process.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 WEBKIT_COMMON_GPU_CONTEXT_PROVIDER_IN_PROCESS_H_ 5 #ifndef WEBKIT_COMMON_GPU_CONTEXT_PROVIDER_IN_PROCESS_H_
6 #define WEBKIT_COMMON_GPU_CONTEXT_PROVIDER_IN_PROCESS_H_ 6 #define WEBKIT_COMMON_GPU_CONTEXT_PROVIDER_IN_PROCESS_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
11 #include "base/threading/thread_checker.h" 11 #include "base/threading/thread_checker.h"
12 #include "cc/output/context_provider.h" 12 #include "cc/output/context_provider.h"
13 #include "webkit/common/gpu/webkit_gpu_export.h" 13 #include "webkit/common/gpu/webkit_gpu_export.h"
14 14
15 namespace WebKit { 15 namespace WebKit {
16 class WebGraphicsContext3D; 16 class WebGraphicsContext3D;
17 } 17 }
18 18
19 namespace webkit { 19 namespace webkit {
20 namespace gpu { 20 namespace gpu {
21 class GrContextForWebGraphicsContext3D; 21 class GrContextForWebGraphicsContext3D;
22 class WebGraphicsContext3DInProcessCommandBufferImpl;
22 23
23 class WEBKIT_GPU_EXPORT ContextProviderInProcess 24 class WEBKIT_GPU_EXPORT ContextProviderInProcess
24 : NON_EXPORTED_BASE(public cc::ContextProvider) { 25 : NON_EXPORTED_BASE(public cc::ContextProvider) {
25 public: 26 public:
26 static scoped_refptr<ContextProviderInProcess> Create() { 27 typedef base::Callback<
27 scoped_refptr<ContextProviderInProcess> provider = 28 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>(void)>
28 new ContextProviderInProcess; 29 CreateCallback;
29 if (!provider->InitializeOnMainThread()) 30
30 return NULL; 31 static scoped_refptr<ContextProviderInProcess> Create(
31 return provider; 32 const CreateCallback& create_callback);
32 } 33
34 // Calls Create() with a default factory method for creating an offscreen
35 // context.
36 static scoped_refptr<ContextProviderInProcess> CreateOffscreen();
boliu 2013/08/14 04:09:27 Need to update the android-only synchronous_compos
danakj 2013/08/14 04:10:40 Ah, thanks! Done.
33 37
34 virtual bool BindToCurrentThread() OVERRIDE; 38 virtual bool BindToCurrentThread() OVERRIDE;
35 virtual WebKit::WebGraphicsContext3D* Context3d() OVERRIDE; 39 virtual WebKit::WebGraphicsContext3D* Context3d() OVERRIDE;
36 virtual class GrContext* GrContext() OVERRIDE; 40 virtual class GrContext* GrContext() OVERRIDE;
37 virtual void VerifyContexts() OVERRIDE; 41 virtual void VerifyContexts() OVERRIDE;
38 virtual bool DestroyedOnMainThread() OVERRIDE; 42 virtual bool DestroyedOnMainThread() OVERRIDE;
39 virtual void SetLostContextCallback( 43 virtual void SetLostContextCallback(
40 const LostContextCallback& lost_context_callback) OVERRIDE; 44 const LostContextCallback& lost_context_callback) OVERRIDE;
41 45
42 protected: 46 protected:
43 ContextProviderInProcess(); 47 ContextProviderInProcess();
44 virtual ~ContextProviderInProcess(); 48 virtual ~ContextProviderInProcess();
45 49
46 bool InitializeOnMainThread(); 50 bool InitializeOnMainThread(
51 const CreateCallback& create_callback);
47 52
48 void OnLostContext(); 53 void OnLostContext();
49 void OnMemoryAllocationChanged(bool nonzero_allocation); 54 void OnMemoryAllocationChanged(bool nonzero_allocation);
50 55
51 private: 56 private:
52 base::ThreadChecker main_thread_checker_; 57 base::ThreadChecker main_thread_checker_;
53 base::ThreadChecker context_thread_checker_; 58 base::ThreadChecker context_thread_checker_;
54 59
55 scoped_ptr<WebKit::WebGraphicsContext3D> context3d_; 60 scoped_ptr<WebKit::WebGraphicsContext3D> context3d_;
56 scoped_ptr<webkit::gpu::GrContextForWebGraphicsContext3D> gr_context_; 61 scoped_ptr<webkit::gpu::GrContextForWebGraphicsContext3D> gr_context_;
57 62
58 LostContextCallback lost_context_callback_; 63 LostContextCallback lost_context_callback_;
59 64
60 base::Lock destroyed_lock_; 65 base::Lock destroyed_lock_;
61 bool destroyed_; 66 bool destroyed_;
62 67
63 class LostContextCallbackProxy; 68 class LostContextCallbackProxy;
64 scoped_ptr<LostContextCallbackProxy> lost_context_callback_proxy_; 69 scoped_ptr<LostContextCallbackProxy> lost_context_callback_proxy_;
65 70
66 class MemoryAllocationCallbackProxy; 71 class MemoryAllocationCallbackProxy;
67 scoped_ptr<MemoryAllocationCallbackProxy> memory_allocation_callback_proxy_; 72 scoped_ptr<MemoryAllocationCallbackProxy> memory_allocation_callback_proxy_;
68 }; 73 };
69 74
70 } // namespace gpu 75 } // namespace gpu
71 } // namespace webkit 76 } // namespace webkit
72 77
73 #endif // WEBKIT_COMMON_GPU_CONTEXT_PROVIDER_IN_PROCESS_H_ 78 #endif // WEBKIT_COMMON_GPU_CONTEXT_PROVIDER_IN_PROCESS_H_
OLDNEW
« no previous file with comments | « ui/compositor/compositor.cc ('k') | webkit/common/gpu/context_provider_in_process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698