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

Side by Side Diff: content/common/gpu/gpu_command_buffer_stub.h

Issue 11187010: Rename SurfaceState to MemoryManagerState (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 | « no previous file | content/common/gpu/gpu_command_buffer_stub.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_GPU_COMMAND_BUFFER_STUB_H_ 5 #ifndef CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_
6 #define CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ 6 #define CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 30 matching lines...) Expand all
41 namespace gpu { 41 namespace gpu {
42 namespace gles2 { 42 namespace gles2 {
43 class MailboxManager; 43 class MailboxManager;
44 } 44 }
45 } 45 }
46 46
47 // This Base class is used to expose methods of GpuCommandBufferStub used for 47 // This Base class is used to expose methods of GpuCommandBufferStub used for
48 // testability. 48 // testability.
49 class CONTENT_EXPORT GpuCommandBufferStubBase { 49 class CONTENT_EXPORT GpuCommandBufferStubBase {
50 public: 50 public:
51 struct CONTENT_EXPORT SurfaceState { 51 struct CONTENT_EXPORT MemoryManagerState {
52 int32 surface_id; 52 // Offscreen commandbuffers will not have a surface.
53 bool has_surface;
53 bool visible; 54 bool visible;
55 bool client_has_memory_allocation_changed_callback;
56 // Use time is determined by the last time that visibility was changed
Ken Russell (switch to Gerrit) 2012/10/16 22:06:01 Nit: prefer complete sentences in comments. http:/
ccameron 2012/10/16 22:29:32 Done.
54 base::TimeTicks last_used_time; 57 base::TimeTicks last_used_time;
55 58
56 SurfaceState(int32 surface_id, 59 MemoryManagerState(
57 bool visible, 60 bool has_surface,
58 base::TimeTicks last_used_time); 61 bool visible,
62 base::TimeTicks last_used_time);
59 }; 63 };
60 64
61 public: 65 public:
62 virtual ~GpuCommandBufferStubBase() {} 66 virtual ~GpuCommandBufferStubBase() {}
63 67
64 // Will not have surface state if this is an offscreen commandbuffer. 68 virtual const MemoryManagerState& memory_manager_state() const = 0;
65 virtual bool client_has_memory_allocation_changed_callback() const = 0;
66 virtual bool has_surface_state() const = 0;
67 virtual const SurfaceState& surface_state() const = 0;
68 69
69 virtual gfx::Size GetSurfaceSize() const = 0; 70 virtual gfx::Size GetSurfaceSize() const = 0;
70 71
71 virtual bool IsInSameContextShareGroup( 72 virtual bool IsInSameContextShareGroup(
72 const GpuCommandBufferStubBase& other) const = 0; 73 const GpuCommandBufferStubBase& other) const = 0;
73 74
74 virtual void SetMemoryAllocation( 75 virtual void SetMemoryAllocation(
75 const GpuMemoryAllocation& allocation) = 0; 76 const GpuMemoryAllocation& allocation) = 0;
76 77
77 virtual bool GetTotalGpuMemory(size_t* bytes) = 0; 78 virtual bool GetTotalGpuMemory(size_t* bytes) = 0;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 111
111 virtual ~GpuCommandBufferStub(); 112 virtual ~GpuCommandBufferStub();
112 113
113 // IPC::Listener implementation: 114 // IPC::Listener implementation:
114 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 115 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
115 116
116 // IPC::Sender implementation: 117 // IPC::Sender implementation:
117 virtual bool Send(IPC::Message* msg) OVERRIDE; 118 virtual bool Send(IPC::Message* msg) OVERRIDE;
118 119
119 // GpuCommandBufferStubBase implementation: 120 // GpuCommandBufferStubBase implementation:
120 virtual bool client_has_memory_allocation_changed_callback() const OVERRIDE; 121 virtual const GpuCommandBufferStubBase::MemoryManagerState&
121 virtual bool has_surface_state() const OVERRIDE; 122 memory_manager_state() const OVERRIDE {
122 virtual const GpuCommandBufferStubBase::SurfaceState& surface_state() const 123 return *memory_manager_state_.get();
123 OVERRIDE; 124 }
124 125
125 // Returns surface size. 126 // Returns surface size.
126 virtual gfx::Size GetSurfaceSize() const OVERRIDE; 127 virtual gfx::Size GetSurfaceSize() const OVERRIDE;
127 128
128 // Returns true iff |other| is in the same context share group as this stub. 129 // Returns true iff |other| is in the same context share group as this stub.
129 virtual bool IsInSameContextShareGroup( 130 virtual bool IsInSameContextShareGroup(
130 const GpuCommandBufferStubBase& other) const OVERRIDE; 131 const GpuCommandBufferStubBase& other) const OVERRIDE;
131 132
132 // Sets buffer usage depending on Memory Allocation 133 // Sets buffer usage depending on Memory Allocation
133 virtual void SetMemoryAllocation( 134 virtual void SetMemoryAllocation(
(...skipping 12 matching lines...) Expand all
146 147
147 // Delay an echo message until the command buffer has been rescheduled. 148 // Delay an echo message until the command buffer has been rescheduled.
148 void DelayEcho(IPC::Message*); 149 void DelayEcho(IPC::Message*);
149 150
150 gpu::gles2::GLES2Decoder* decoder() const { return decoder_.get(); } 151 gpu::gles2::GLES2Decoder* decoder() const { return decoder_.get(); }
151 gpu::GpuScheduler* scheduler() const { return scheduler_.get(); } 152 gpu::GpuScheduler* scheduler() const { return scheduler_.get(); }
152 GpuChannel* channel() const { return channel_; } 153 GpuChannel* channel() const { return channel_; }
153 154
154 // Identifies the target surface. 155 // Identifies the target surface.
155 int32 surface_id() const { 156 int32 surface_id() const {
156 return (surface_state_.get()) ? surface_state_->surface_id : 0; 157 return surface_id_;
157 } 158 }
158 159
159 // Identifies the various GpuCommandBufferStubs in the GPU process belonging 160 // Identifies the various GpuCommandBufferStubs in the GPU process belonging
160 // to the same renderer process. 161 // to the same renderer process.
161 int32 route_id() const { return route_id_; } 162 int32 route_id() const { return route_id_; }
162 163
163 gfx::GpuPreference gpu_preference() { return gpu_preference_; } 164 gfx::GpuPreference gpu_preference() { return gpu_preference_; }
164 165
165 // Sends a message to the console. 166 // Sends a message to the console.
166 void SendConsoleMessage(int32 id, const std::string& message); 167 void SendConsoleMessage(int32 id, const std::string& message);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 // The group of contexts that share namespaces with this context. 250 // The group of contexts that share namespaces with this context.
250 scoped_refptr<gpu::gles2::ContextGroup> context_group_; 251 scoped_refptr<gpu::gles2::ContextGroup> context_group_;
251 252
252 gfx::GLSurfaceHandle handle_; 253 gfx::GLSurfaceHandle handle_;
253 gfx::Size initial_size_; 254 gfx::Size initial_size_;
254 gpu::gles2::DisallowedFeatures disallowed_features_; 255 gpu::gles2::DisallowedFeatures disallowed_features_;
255 std::string allowed_extensions_; 256 std::string allowed_extensions_;
256 std::vector<int32> requested_attribs_; 257 std::vector<int32> requested_attribs_;
257 gfx::GpuPreference gpu_preference_; 258 gfx::GpuPreference gpu_preference_;
258 int32 route_id_; 259 int32 route_id_;
260 int32 surface_id_;
259 bool software_; 261 bool software_;
260 bool client_has_memory_allocation_changed_callback_;
261 uint32 last_flush_count_; 262 uint32 last_flush_count_;
262 scoped_ptr<GpuCommandBufferStubBase::SurfaceState> surface_state_; 263 scoped_ptr<MemoryManagerState> memory_manager_state_;
263 264
264 scoped_ptr<gpu::CommandBufferService> command_buffer_; 265 scoped_ptr<gpu::CommandBufferService> command_buffer_;
265 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_; 266 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_;
266 scoped_ptr<gpu::GpuScheduler> scheduler_; 267 scoped_ptr<gpu::GpuScheduler> scheduler_;
267 scoped_refptr<gfx::GLContext> context_; 268 scoped_refptr<gfx::GLContext> context_;
268 scoped_refptr<gfx::GLSurface> surface_; 269 scoped_refptr<gfx::GLSurface> surface_;
269 270
270 // SetParent may be called before Initialize, in which case we need to keep 271 // SetParent may be called before Initialize, in which case we need to keep
271 // around the parent stub, so that Initialize can set the parent correctly. 272 // around the parent stub, so that Initialize can set the parent correctly.
272 base::WeakPtr<GpuCommandBufferStub> parent_stub_for_initialization_; 273 base::WeakPtr<GpuCommandBufferStub> parent_stub_for_initialization_;
(...skipping 17 matching lines...) Expand all
290 291
291 scoped_refptr<gpu::RefCountedCounter> preempt_by_counter_; 292 scoped_refptr<gpu::RefCountedCounter> preempt_by_counter_;
292 293
293 GURL active_url_; 294 GURL active_url_;
294 size_t active_url_hash_; 295 size_t active_url_hash_;
295 296
296 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); 297 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub);
297 }; 298 };
298 299
299 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ 300 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_
OLDNEW
« no previous file with comments | « no previous file | content/common/gpu/gpu_command_buffer_stub.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698