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

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

Issue 9702081: Splitting GpuMemoryAllocation into two parts: for renderer and browser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adding unittests for GpuMemoryAllocation comparison functions since they have become not as trivial. Created 8 years, 9 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/client/command_buffer_proxy.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_CLIENT_COMMAND_BUFFER_PROXY_H_ 5 #ifndef CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_H_
6 #define CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_H_ 6 #define CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_H_
7 #pragma once 7 #pragma once
8 8
9 #if defined(ENABLE_GPU) 9 #if defined(ENABLE_GPU)
10 10
11 #include <map> 11 #include <map>
12 #include <queue> 12 #include <queue>
13 #include <string> 13 #include <string>
14 14
15 #include "base/callback.h" 15 #include "base/callback.h"
16 #include "base/memory/linked_ptr.h" 16 #include "base/memory/linked_ptr.h"
17 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "content/common/gpu/client/gpu_video_decode_accelerator_host.h" 19 #include "content/common/gpu/client/gpu_video_decode_accelerator_host.h"
20 #include "gpu/command_buffer/common/command_buffer.h" 20 #include "gpu/command_buffer/common/command_buffer.h"
21 #include "gpu/command_buffer/common/command_buffer_shared.h" 21 #include "gpu/command_buffer/common/command_buffer_shared.h"
22 #include "ipc/ipc_channel.h" 22 #include "ipc/ipc_channel.h"
23 #include "ipc/ipc_message.h" 23 #include "ipc/ipc_message.h"
24 24
25 class GpuChannelHost; 25 class GpuChannelHost;
26 struct GPUCommandBufferConsoleMessage; 26 struct GPUCommandBufferConsoleMessage;
27 class GpuMemoryAllocation; 27 struct GpuMemoryAllocationForRenderer;
28 28
29 namespace base { 29 namespace base {
30 class SharedMemory; 30 class SharedMemory;
31 } 31 }
32 32
33 // Client side proxy that forwards messages synchronously to a 33 // Client side proxy that forwards messages synchronously to a
34 // CommandBufferStub. 34 // CommandBufferStub.
35 class CommandBufferProxy : public gpu::CommandBuffer, 35 class CommandBufferProxy : public gpu::CommandBuffer,
36 public IPC::Channel::Listener, 36 public IPC::Channel::Listener,
37 public base::SupportsWeakPtr<CommandBufferProxy> { 37 public base::SupportsWeakPtr<CommandBufferProxy> {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 // Invoke the task when the channel has been flushed. Takes care of deleting 70 // Invoke the task when the channel has been flushed. Takes care of deleting
71 // the task whether the echo succeeds or not. 71 // the task whether the echo succeeds or not.
72 bool Echo(const base::Closure& callback); 72 bool Echo(const base::Closure& callback);
73 73
74 // Sends an IPC message with the new state of surface visibility. 74 // Sends an IPC message with the new state of surface visibility.
75 bool SetSurfaceVisible(bool visible); 75 bool SetSurfaceVisible(bool visible);
76 76
77 // Register a callback to invoke whenever we recieve a new memory allocation. 77 // Register a callback to invoke whenever we recieve a new memory allocation.
78 void SetMemoryAllocationChangedCallback( 78 void SetMemoryAllocationChangedCallback(
79 const base::Callback<void(const GpuMemoryAllocation&)>& callback); 79 const base::Callback<void(const GpuMemoryAllocationForRenderer&)>&
80 callback);
80 81
81 // Reparent a command buffer. TODO(apatrick): going forward, the notion of 82 // Reparent a command buffer. TODO(apatrick): going forward, the notion of
82 // the parent / child relationship between command buffers is going away in 83 // the parent / child relationship between command buffers is going away in
83 // favor of the notion of surfaces that can be drawn to in one command buffer 84 // favor of the notion of surfaces that can be drawn to in one command buffer
84 // and bound as a texture in any other. 85 // and bound as a texture in any other.
85 virtual bool SetParent(CommandBufferProxy* parent_command_buffer, 86 virtual bool SetParent(CommandBufferProxy* parent_command_buffer,
86 uint32 parent_texture_id); 87 uint32 parent_texture_id);
87 88
88 void SetChannelErrorCallback(const base::Closure& callback); 89 void SetChannelErrorCallback(const base::Closure& callback);
89 90
(...skipping 26 matching lines...) Expand all
116 // encapsulate the channel; all callers of this function must explicitly 117 // encapsulate the channel; all callers of this function must explicitly
117 // verify that the context has not been lost. 118 // verify that the context has not been lost.
118 bool Send(IPC::Message* msg); 119 bool Send(IPC::Message* msg);
119 120
120 // Message handlers: 121 // Message handlers:
121 void OnUpdateState(const gpu::CommandBuffer::State& state); 122 void OnUpdateState(const gpu::CommandBuffer::State& state);
122 void OnNotifyRepaint(); 123 void OnNotifyRepaint();
123 void OnDestroyed(gpu::error::ContextLostReason reason); 124 void OnDestroyed(gpu::error::ContextLostReason reason);
124 void OnEchoAck(); 125 void OnEchoAck();
125 void OnConsoleMessage(const GPUCommandBufferConsoleMessage& message); 126 void OnConsoleMessage(const GPUCommandBufferConsoleMessage& message);
126 void OnSetMemoryAllocation(const GpuMemoryAllocation& allocation); 127 void OnSetMemoryAllocation(const GpuMemoryAllocationForRenderer& allocation);
127 128
128 // Try to read an updated copy of the state from shared memory. 129 // Try to read an updated copy of the state from shared memory.
129 void TryUpdateState(); 130 void TryUpdateState();
130 131
131 // Local cache of id to transfer buffer mapping. 132 // Local cache of id to transfer buffer mapping.
132 typedef std::map<int32, gpu::Buffer> TransferBufferMap; 133 typedef std::map<int32, gpu::Buffer> TransferBufferMap;
133 TransferBufferMap transfer_buffers_; 134 TransferBufferMap transfer_buffers_;
134 135
135 // Zero or more video decoder hosts owned by this proxy, keyed by their 136 // Zero or more video decoder hosts owned by this proxy, keyed by their
136 // decoder_route_id. 137 // decoder_route_id.
(...skipping 13 matching lines...) Expand all
150 unsigned int flush_count_; 151 unsigned int flush_count_;
151 int32 last_put_offset_; 152 int32 last_put_offset_;
152 153
153 // Tasks to be invoked in echo responses. 154 // Tasks to be invoked in echo responses.
154 std::queue<base::Closure> echo_tasks_; 155 std::queue<base::Closure> echo_tasks_;
155 156
156 base::Closure notify_repaint_task_; 157 base::Closure notify_repaint_task_;
157 158
158 base::Closure channel_error_callback_; 159 base::Closure channel_error_callback_;
159 160
160 base::Callback<void(const GpuMemoryAllocation&)> 161 base::Callback<void(const GpuMemoryAllocationForRenderer&)>
161 memory_allocation_changed_callback_; 162 memory_allocation_changed_callback_;
162 163
163 GpuConsoleMessageCallback console_message_callback_; 164 GpuConsoleMessageCallback console_message_callback_;
164 165
165 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxy); 166 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxy);
166 }; 167 };
167 168
168 #endif // ENABLE_GPU 169 #endif // ENABLE_GPU
169 170
170 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_H_ 171 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_H_
OLDNEW
« no previous file with comments | « no previous file | content/common/gpu/client/command_buffer_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698