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

Side by Side Diff: gpu/command_buffer/service/in_process_command_buffer.h

Issue 22277004: Add gfx::SurfaceFactoryWebview (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: InProcessContext takes attrib struct 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ 6 #define GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/synchronization/lock.h" 14 #include "base/synchronization/lock.h"
15 #include "base/synchronization/waitable_event.h" 15 #include "base/synchronization/waitable_event.h"
16 #include "gpu/command_buffer/common/command_buffer.h" 16 #include "gpu/command_buffer/common/command_buffer.h"
17 #include "gpu/gpu_export.h" 17 #include "gpu/gpu_export.h"
18 #include "ui/gfx/gpu_memory_buffer.h" 18 #include "ui/gfx/gpu_memory_buffer.h"
19 #include "ui/gfx/native_widget_types.h" 19 #include "ui/gfx/native_widget_types.h"
20 #include "ui/gl/gl_surface.h"
20 #include "ui/gl/gpu_preference.h" 21 #include "ui/gl/gpu_preference.h"
21 22
23 namespace base {
24 class SequenceChecker;
25 }
26
22 namespace gfx { 27 namespace gfx {
23 class GLContext; 28 class GLContext;
24 class GLImage; 29 class GLImage;
25 class GLSurface; 30 class GLSurface;
26 class Size; 31 class Size;
27 } 32 }
28 33
29 namespace gpu { 34 namespace gpu {
30 35
31 namespace gles2 { 36 namespace gles2 {
(...skipping 18 matching lines...) Expand all
50 // The callback will be called from different client threads. After the 55 // The callback will be called from different client threads. After the
51 // callback is issued, the client is expected to eventually call 56 // callback is issued, the client is expected to eventually call
52 // ProcessGpuWorkOnCurrentThread(). The latter cannot be called from different 57 // ProcessGpuWorkOnCurrentThread(). The latter cannot be called from different
53 // threads. 58 // threads.
54 // The callback needs to be set before any context is created. 59 // The callback needs to be set before any context is created.
55 static void SetScheduleCallback(const base::Closure& callback); 60 static void SetScheduleCallback(const base::Closure& callback);
56 static void ProcessGpuWorkOnCurrentThread(); 61 static void ProcessGpuWorkOnCurrentThread();
57 62
58 static void EnableVirtualizedContext(); 63 static void EnableVirtualizedContext();
59 64
60 bool Initialize(bool is_offscreen, 65 // If |surface| is not NULL, use it directly; in this case, the command
66 // buffer gpu thread must be the same as the client thread. Otherwise create
67 // a new GLSurface.
68 bool Initialize(scoped_refptr<gfx::GLSurface> surface,
69 bool is_offscreen,
61 bool share_resources, 70 bool share_resources,
62 gfx::AcceleratedWidget window, 71 gfx::AcceleratedWidget window,
63 const gfx::Size& size, 72 const gfx::Size& size,
64 const char* allowed_extensions, 73 const char* allowed_extensions,
65 const std::vector<int32>& attribs, 74 const std::vector<int32>& attribs,
66 gfx::GpuPreference gpu_preference, 75 gfx::GpuPreference gpu_preference,
67 const base::Closure& context_lost_callback, 76 const base::Closure& context_lost_callback,
68 unsigned int share_group_id); 77 unsigned int share_group_id);
69 void Destroy(); 78 void Destroy();
70 void SignalSyncPoint(unsigned sync_point, 79 void SignalSyncPoint(unsigned sync_point,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 void FlushOnGpuThread(int32 put_offset); 120 void FlushOnGpuThread(int32 put_offset);
112 void CreateImageOnGpuThread(gfx::GpuMemoryBufferHandle buffer, 121 void CreateImageOnGpuThread(gfx::GpuMemoryBufferHandle buffer,
113 gfx::Size size, 122 gfx::Size size,
114 unsigned int image_id); 123 unsigned int image_id);
115 void RemoveImageOnGpuThread(unsigned int image_id); 124 void RemoveImageOnGpuThread(unsigned int image_id);
116 bool MakeCurrent(); 125 bool MakeCurrent();
117 bool IsContextLost(); 126 bool IsContextLost();
118 base::Closure WrapCallback(const base::Closure& callback); 127 base::Closure WrapCallback(const base::Closure& callback);
119 State GetStateFast(); 128 State GetStateFast();
120 void QueueTask(const base::Closure& task) { queue_->QueueTask(task); } 129 void QueueTask(const base::Closure& task) { queue_->QueueTask(task); }
130 void CheckSequencedThread();
121 131
122 // Callbacks: 132 // Callbacks:
123 void OnContextLost(); 133 void OnContextLost();
124 void OnResizeView(gfx::Size size, float scale_factor); 134 void OnResizeView(gfx::Size size, float scale_factor);
125 bool GetBufferChanged(int32 transfer_buffer_id); 135 bool GetBufferChanged(int32 transfer_buffer_id);
126 void PumpCommands(); 136 void PumpCommands();
127 137
128 // Members accessed on the gpu thread (possibly with the exception of 138 // Members accessed on the gpu thread (possibly with the exception of
129 // creation): 139 // creation):
130 bool context_lost_; 140 bool context_lost_;
131 bool share_resources_; 141 bool share_resources_;
132 scoped_ptr<TransferBufferManagerInterface> transfer_buffer_manager_; 142 scoped_ptr<TransferBufferManagerInterface> transfer_buffer_manager_;
133 scoped_ptr<GpuScheduler> gpu_scheduler_; 143 scoped_ptr<GpuScheduler> gpu_scheduler_;
134 scoped_ptr<gles2::GLES2Decoder> decoder_; 144 scoped_ptr<gles2::GLES2Decoder> decoder_;
135 scoped_refptr<gfx::GLContext> context_; 145 scoped_refptr<gfx::GLContext> context_;
136 scoped_refptr<gfx::GLSurface> surface_; 146 scoped_refptr<gfx::GLSurface> surface_;
137 base::Closure context_lost_callback_; 147 base::Closure context_lost_callback_;
138 unsigned int share_group_id_; 148 unsigned int share_group_id_;
139 149
140 // Members accessed on the client thread: 150 // Members accessed on the client thread:
141 State last_state_; 151 State last_state_;
142 int32 last_put_offset_; 152 int32 last_put_offset_;
143 153
144 // Accessed on both threads: 154 // Accessed on both threads:
145 scoped_ptr<CommandBuffer> command_buffer_; 155 scoped_ptr<CommandBuffer> command_buffer_;
146 base::Lock command_buffer_lock_; 156 base::Lock command_buffer_lock_;
147 base::WaitableEvent flush_event_; 157 base::WaitableEvent flush_event_;
148 scoped_ptr<SchedulerClient> queue_; 158 scoped_ptr<SchedulerClient> queue_;
149 159
160 // Only used with explicit scheduling and the gpu thread is the same as
161 // the client thread.
162 scoped_ptr<base::SequenceChecker> sequence_checker_;
163
150 DISALLOW_COPY_AND_ASSIGN(InProcessCommandBuffer); 164 DISALLOW_COPY_AND_ASSIGN(InProcessCommandBuffer);
151 }; 165 };
152 166
153 } // namespace gpu 167 } // namespace gpu
154 168
155 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ 169 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698