OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_RENDERER_GPU_COMMAND_BUFFER_PROXY_H_ | 5 #ifndef CONTENT_RENDERER_GPU_COMMAND_BUFFER_PROXY_H_ |
6 #define CONTENT_RENDERER_GPU_COMMAND_BUFFER_PROXY_H_ | 6 #define CONTENT_RENDERER_GPU_COMMAND_BUFFER_PROXY_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #if defined(ENABLE_GPU) | 9 #if defined(ENABLE_GPU) |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 virtual bool OnMessageReceived(const IPC::Message& message); | 41 virtual bool OnMessageReceived(const IPC::Message& message); |
42 virtual void OnChannelError(); | 42 virtual void OnChannelError(); |
43 | 43 |
44 int route_id() const { return route_id_; } | 44 int route_id() const { return route_id_; } |
45 | 45 |
46 // CommandBuffer implementation: | 46 // CommandBuffer implementation: |
47 virtual bool Initialize(int32 size); | 47 virtual bool Initialize(int32 size); |
48 virtual bool Initialize(base::SharedMemory* buffer, int32 size); | 48 virtual bool Initialize(base::SharedMemory* buffer, int32 size); |
49 virtual gpu::Buffer GetRingBuffer(); | 49 virtual gpu::Buffer GetRingBuffer(); |
50 virtual State GetState(); | 50 virtual State GetState(); |
| 51 virtual State GetLastState(); |
51 virtual void Flush(int32 put_offset); | 52 virtual void Flush(int32 put_offset); |
52 virtual State FlushSync(int32 put_offset, int32 last_known_get); | 53 virtual State FlushSync(int32 put_offset, int32 last_known_get); |
53 virtual void SetGetOffset(int32 get_offset); | 54 virtual void SetGetOffset(int32 get_offset); |
54 virtual int32 CreateTransferBuffer(size_t size, int32 id_request); | 55 virtual int32 CreateTransferBuffer(size_t size, int32 id_request); |
55 virtual int32 RegisterTransferBuffer(base::SharedMemory* shared_memory, | 56 virtual int32 RegisterTransferBuffer(base::SharedMemory* shared_memory, |
56 size_t size, | 57 size_t size, |
57 int32 id_request); | 58 int32 id_request); |
58 virtual void DestroyTransferBuffer(int32 id); | 59 virtual void DestroyTransferBuffer(int32 id); |
59 virtual gpu::Buffer GetTransferBuffer(int32 handle); | 60 virtual gpu::Buffer GetTransferBuffer(int32 handle); |
60 virtual void SetToken(int32 token); | 61 virtual void SetToken(int32 token); |
(...skipping 16 matching lines...) Expand all Loading... |
77 void ResizeOffscreenFrameBuffer(const gfx::Size& size); | 78 void ResizeOffscreenFrameBuffer(const gfx::Size& size); |
78 | 79 |
79 // Set a task that will be invoked the next time the window becomes invalid | 80 // Set a task that will be invoked the next time the window becomes invalid |
80 // and needs to be repainted. Takes ownership of task. | 81 // and needs to be repainted. Takes ownership of task. |
81 void SetNotifyRepaintTask(Task* task); | 82 void SetNotifyRepaintTask(Task* task); |
82 | 83 |
83 #if defined(OS_MACOSX) | 84 #if defined(OS_MACOSX) |
84 virtual void SetWindowSize(const gfx::Size& size); | 85 virtual void SetWindowSize(const gfx::Size& size); |
85 #endif | 86 #endif |
86 | 87 |
87 // Get the last state received from the service without synchronizing. | |
88 State GetLastState() { | |
89 return last_state_; | |
90 } | |
91 | |
92 private: | 88 private: |
93 | 89 |
94 // Send an IPC message over the GPU channel. This is private to fully | 90 // Send an IPC message over the GPU channel. This is private to fully |
95 // encapsulate the channel; all callers of this function must explicitly | 91 // encapsulate the channel; all callers of this function must explicitly |
96 // verify that the context has not been lost. | 92 // verify that the context has not been lost. |
97 bool Send(IPC::Message* msg); | 93 bool Send(IPC::Message* msg); |
98 | 94 |
99 // Message handlers: | 95 // Message handlers: |
100 void OnUpdateState(const gpu::CommandBuffer::State& state); | 96 void OnUpdateState(const gpu::CommandBuffer::State& state); |
101 void OnNotifyRepaint(); | 97 void OnNotifyRepaint(); |
(...skipping 18 matching lines...) Expand all Loading... |
120 | 116 |
121 scoped_ptr<Callback0::Type> swap_buffers_callback_; | 117 scoped_ptr<Callback0::Type> swap_buffers_callback_; |
122 scoped_ptr<Callback0::Type> channel_error_callback_; | 118 scoped_ptr<Callback0::Type> channel_error_callback_; |
123 | 119 |
124 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxy); | 120 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxy); |
125 }; | 121 }; |
126 | 122 |
127 #endif // ENABLE_GPU | 123 #endif // ENABLE_GPU |
128 | 124 |
129 #endif // CONTENT_RENDERER_GPU_COMMAND_BUFFER_PROXY_H_ | 125 #endif // CONTENT_RENDERER_GPU_COMMAND_BUFFER_PROXY_H_ |
OLD | NEW |