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

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

Issue 11267035: Fix layering violation where content is included by gpu. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove NOTIMPLEMENTED entrypoints Created 8 years, 1 month 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/gpu_channel_host.h » ('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_IMPL_H_ 5 #ifndef CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_
6 #define CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ 6 #define CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_
7 7
8 #if defined(ENABLE_GPU) 8 #if defined(ENABLE_GPU)
9 9
10 #include <map> 10 #include <map>
11 #include <queue> 11 #include <queue>
12 #include <string> 12 #include <string>
13 13
14 #include "gpu/ipc/command_buffer_proxy.h" 14 #include "gpu/ipc/command_buffer_proxy.h"
15 15
16 #include "base/callback.h" 16 #include "base/callback.h"
17 #include "base/compiler_specific.h" 17 #include "base/compiler_specific.h"
18 #include "base/hash_tables.h" 18 #include "base/hash_tables.h"
19 #include "base/memory/ref_counted.h" 19 #include "base/memory/ref_counted.h"
20 #include "base/memory/weak_ptr.h" 20 #include "base/memory/weak_ptr.h"
21 #include "content/common/gpu/client/gpu_video_decode_accelerator_host.h" 21 #include "content/common/gpu/client/gpu_video_decode_accelerator_host.h"
22 #include "content/common/gpu/gpu_memory_allocation.h"
22 #include "gpu/command_buffer/common/command_buffer.h" 23 #include "gpu/command_buffer/common/command_buffer.h"
23 #include "gpu/command_buffer/common/command_buffer_shared.h" 24 #include "gpu/command_buffer/common/command_buffer_shared.h"
24 #include "ipc/ipc_listener.h" 25 #include "ipc/ipc_listener.h"
25 26
26 struct GPUCommandBufferConsoleMessage; 27 struct GPUCommandBufferConsoleMessage;
27 28
28 namespace base { 29 namespace base {
29 class SharedMemory; 30 class SharedMemory;
30 } 31 }
31 32
32 namespace content { 33 namespace content {
33 class GpuChannelHost; 34 class GpuChannelHost;
34 struct GpuMemoryAllocationForRenderer;
35 35
36 // Client side proxy that forwards messages synchronously to a 36 // Client side proxy that forwards messages synchronously to a
37 // CommandBufferStub. 37 // CommandBufferStub.
38 class CommandBufferProxyImpl 38 class CommandBufferProxyImpl
39 : public CommandBufferProxy, 39 : public CommandBufferProxy,
40 public IPC::Listener, 40 public IPC::Listener,
41 public base::SupportsWeakPtr<CommandBufferProxyImpl> { 41 public base::SupportsWeakPtr<CommandBufferProxyImpl> {
42 public: 42 public:
43 typedef base::Callback<void( 43 typedef base::Callback<void(
44 const std::string& msg, int id)> GpuConsoleMessageCallback; 44 const std::string& msg, int id)> GpuConsoleMessageCallback;
(...skipping 11 matching lines...) Expand all
56 media::VideoCodecProfile profile, 56 media::VideoCodecProfile profile,
57 media::VideoDecodeAccelerator::Client* client); 57 media::VideoDecodeAccelerator::Client* client);
58 58
59 // IPC::Listener implementation: 59 // IPC::Listener implementation:
60 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 60 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
61 virtual void OnChannelError() OVERRIDE; 61 virtual void OnChannelError() OVERRIDE;
62 62
63 // CommandBufferProxy implementation: 63 // CommandBufferProxy implementation:
64 virtual int GetRouteID() const OVERRIDE; 64 virtual int GetRouteID() const OVERRIDE;
65 virtual bool Echo(const base::Closure& callback) OVERRIDE; 65 virtual bool Echo(const base::Closure& callback) OVERRIDE;
66 virtual bool SetSurfaceVisible(bool visible) OVERRIDE;
67 virtual bool DiscardBackbuffer() OVERRIDE;
68 virtual bool EnsureBackbuffer() OVERRIDE;
69 virtual uint32 InsertSyncPoint() OVERRIDE;
70 virtual void WaitSyncPoint(uint32 sync_point) OVERRIDE;
71 virtual bool SignalSyncPoint(uint32 sync_point,
72 const base::Closure& callback) OVERRIDE;
73 virtual void SetMemoryAllocationChangedCallback(
74 const base::Callback<void(const GpuMemoryAllocationForRenderer&)>&
75 callback) OVERRIDE;
76 virtual bool SetParent(CommandBufferProxy* parent_command_buffer, 66 virtual bool SetParent(CommandBufferProxy* parent_command_buffer,
77 uint32 parent_texture_id) OVERRIDE; 67 uint32 parent_texture_id) OVERRIDE;
78 virtual void SetChannelErrorCallback(const base::Closure& callback) OVERRIDE; 68 virtual void SetChannelErrorCallback(const base::Closure& callback) OVERRIDE;
79 virtual void SetNotifyRepaintTask(const base::Closure& callback) OVERRIDE;
80 virtual void SetOnConsoleMessageCallback(
81 const GpuConsoleMessageCallback& callback) OVERRIDE;
82 69
83 // CommandBuffer implementation: 70 // CommandBuffer implementation:
84 virtual bool Initialize() OVERRIDE; 71 virtual bool Initialize() OVERRIDE;
85 virtual State GetState() OVERRIDE; 72 virtual State GetState() OVERRIDE;
86 virtual State GetLastState() OVERRIDE; 73 virtual State GetLastState() OVERRIDE;
87 virtual void Flush(int32 put_offset) OVERRIDE; 74 virtual void Flush(int32 put_offset) OVERRIDE;
88 virtual State FlushSync(int32 put_offset, int32 last_known_get) OVERRIDE; 75 virtual State FlushSync(int32 put_offset, int32 last_known_get) OVERRIDE;
89 virtual void SetGetBuffer(int32 shm_id) OVERRIDE; 76 virtual void SetGetBuffer(int32 shm_id) OVERRIDE;
90 virtual void SetGetOffset(int32 get_offset) OVERRIDE; 77 virtual void SetGetOffset(int32 get_offset) OVERRIDE;
91 virtual int32 CreateTransferBuffer(size_t size, int32 id_request) OVERRIDE; 78 virtual int32 CreateTransferBuffer(size_t size, int32 id_request) OVERRIDE;
92 virtual int32 RegisterTransferBuffer(base::SharedMemory* shared_memory, 79 virtual int32 RegisterTransferBuffer(base::SharedMemory* shared_memory,
93 size_t size, 80 size_t size,
94 int32 id_request) OVERRIDE; 81 int32 id_request) OVERRIDE;
95 virtual void DestroyTransferBuffer(int32 id) OVERRIDE; 82 virtual void DestroyTransferBuffer(int32 id) OVERRIDE;
96 virtual gpu::Buffer GetTransferBuffer(int32 handle) OVERRIDE; 83 virtual gpu::Buffer GetTransferBuffer(int32 handle) OVERRIDE;
97 virtual void SetToken(int32 token) OVERRIDE; 84 virtual void SetToken(int32 token) OVERRIDE;
98 virtual void SetParseError(gpu::error::Error error) OVERRIDE; 85 virtual void SetParseError(gpu::error::Error error) OVERRIDE;
99 virtual void SetContextLostReason( 86 virtual void SetContextLostReason(
100 gpu::error::ContextLostReason reason) OVERRIDE; 87 gpu::error::ContextLostReason reason) OVERRIDE;
101 88
89 void SetMemoryAllocationChangedCallback(
90 const base::Callback<void(const GpuMemoryAllocationForRenderer&)>&
91 callback);
92
93 bool DiscardBackbuffer();
94 bool EnsureBackbuffer();
95
96 // Inserts a sync point, returning its ID. This is handled on the IO thread of
97 // the GPU process, and so should be relatively fast, but its effect is
98 // ordered wrt other messages (in particular, Flush). Sync point IDs are
99 // global and can be used for cross-channel synchronization.
100 uint32 InsertSyncPoint();
101
102 // Makes this command buffer wait on a sync point. This command buffer will be
103 // unscheduled until the command buffer that inserted that sync point reaches
104 // it, or gets destroyed.
105 void WaitSyncPoint(uint32);
106
107 // Makes this command buffer invoke a task when a sync point is reached, or
108 // the command buffer that inserted that sync point is destroyed.
109 bool SignalSyncPoint(uint32 sync_point,
110 const base::Closure& callback);
111
112 // Set a task that will be invoked the next time the window becomes invalid
113 // and needs to be repainted. Takes ownership of task.
114 void SetNotifyRepaintTask(const base::Closure& callback);
115
116 // Sends an IPC message with the new state of surface visibility.
117 bool SetSurfaceVisible(bool visible);
118
119 void SetOnConsoleMessageCallback(
120 const GpuConsoleMessageCallback& callback);
121
102 // TODO(apatrick): this is a temporary optimization while skia is calling 122 // TODO(apatrick): this is a temporary optimization while skia is calling
103 // ContentGLContext::MakeCurrent prior to every GL call. It saves returning 6 123 // ContentGLContext::MakeCurrent prior to every GL call. It saves returning 6
104 // ints redundantly when only the error is needed for the 124 // ints redundantly when only the error is needed for the
105 // CommandBufferProxyImpl implementation. 125 // CommandBufferProxyImpl implementation.
106 virtual gpu::error::Error GetLastError() OVERRIDE; 126 virtual gpu::error::Error GetLastError() OVERRIDE;
107 127
108 GpuChannelHost* channel() const { return channel_; } 128 GpuChannelHost* channel() const { return channel_; }
109 129
110 private: 130 private:
111 typedef std::map<int32, gpu::Buffer> TransferBufferMap; 131 typedef std::map<int32, gpu::Buffer> TransferBufferMap;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 int32 state_buffer_; 189 int32 state_buffer_;
170 190
171 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); 191 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl);
172 }; 192 };
173 193
174 } // namespace content 194 } // namespace content
175 195
176 #endif // ENABLE_GPU 196 #endif // ENABLE_GPU
177 197
178 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ 198 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | content/common/gpu/client/gpu_channel_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698