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

Side by Side Diff: content/renderer/command_buffer_proxy.h

Issue 6883179: Rework FlushSync to return early if commands have been processed since the last update (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: style Created 9 years, 7 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 | « content/common/gpu/gpu_messages.h ('k') | content/renderer/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) 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_COMMAND_BUFFER_PROXY_H_ 5 #ifndef CONTENT_RENDERER_COMMAND_BUFFER_PROXY_H_
6 #define CONTENT_RENDERER_COMMAND_BUFFER_PROXY_H_ 6 #define CONTENT_RENDERER_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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 void Flush(int32 put_offset); 51 virtual void Flush(int32 put_offset);
52 virtual State FlushSync(int32 put_offset); 52 virtual State FlushSync(int32 put_offset, int32 last_known_get);
53 virtual void SetGetOffset(int32 get_offset); 53 virtual void SetGetOffset(int32 get_offset);
54 virtual int32 CreateTransferBuffer(size_t size, int32 id_request); 54 virtual int32 CreateTransferBuffer(size_t size, int32 id_request);
55 virtual int32 RegisterTransferBuffer(base::SharedMemory* shared_memory, 55 virtual int32 RegisterTransferBuffer(base::SharedMemory* shared_memory,
56 size_t size, 56 size_t size,
57 int32 id_request); 57 int32 id_request);
58 virtual void DestroyTransferBuffer(int32 id); 58 virtual void DestroyTransferBuffer(int32 id);
59 virtual gpu::Buffer GetTransferBuffer(int32 handle); 59 virtual gpu::Buffer GetTransferBuffer(int32 handle);
60 virtual void SetToken(int32 token); 60 virtual void SetToken(int32 token);
61 virtual void SetParseError(gpu::error::Error error); 61 virtual void SetParseError(gpu::error::Error error);
62 virtual void OnSwapBuffers(); 62 virtual void OnSwapBuffers();
(...skipping 12 matching lines...) Expand all
75 75
76 #if defined(OS_MACOSX) 76 #if defined(OS_MACOSX)
77 virtual void SetWindowSize(const gfx::Size& size); 77 virtual void SetWindowSize(const gfx::Size& size);
78 #endif 78 #endif
79 79
80 // Get the last state received from the service without synchronizing. 80 // Get the last state received from the service without synchronizing.
81 State GetLastState() { 81 State GetLastState() {
82 return last_state_; 82 return last_state_;
83 } 83 }
84 84
85 // Get the state asynchronously. The task is posted when the state is
86 // updated. Takes ownership of the task object.
87 void AsyncGetState(Task* completion_task);
88
89 // Flush the command buffer asynchronously. The task is posted when the flush
90 // completes. Takes ownership of the task object.
91 void AsyncFlush(int32 put_offset, Task* completion_task);
92
93 private: 85 private:
94 86
95 // Send an IPC message over the GPU channel. This is private to fully 87 // Send an IPC message over the GPU channel. This is private to fully
96 // encapsulate the channel; all callers of this function must explicitly 88 // encapsulate the channel; all callers of this function must explicitly
97 // verify that the context has not been lost. 89 // verify that the context has not been lost.
98 bool Send(IPC::Message* msg); 90 bool Send(IPC::Message* msg);
99 91
100 // Message handlers: 92 // Message handlers:
101 void OnUpdateState(const gpu::CommandBuffer::State& state); 93 void OnUpdateState(const gpu::CommandBuffer::State& state);
102 void OnNotifyRepaint(); 94 void OnNotifyRepaint();
103 95
104 // As with the service, the client takes ownership of the ring buffer. 96 // As with the service, the client takes ownership of the ring buffer.
105 int32 num_entries_; 97 int32 num_entries_;
106 scoped_ptr<base::SharedMemory> ring_buffer_; 98 scoped_ptr<base::SharedMemory> ring_buffer_;
107 99
108 // Local cache of id to transfer buffer mapping. 100 // Local cache of id to transfer buffer mapping.
109 typedef std::map<int32, gpu::Buffer> TransferBufferMap; 101 typedef std::map<int32, gpu::Buffer> TransferBufferMap;
110 TransferBufferMap transfer_buffers_; 102 TransferBufferMap transfer_buffers_;
111 103
112 // The last cached state received from the service. 104 // The last cached state received from the service.
113 State last_state_; 105 State last_state_;
114 106
115 IPC::Channel::Sender* channel_; 107 IPC::Channel::Sender* channel_;
116 int route_id_; 108 int route_id_;
117 109
118 // Pending asynchronous flush callbacks.
119 typedef std::queue<linked_ptr<Task> > AsyncFlushTaskQueue;
120 AsyncFlushTaskQueue pending_async_flush_tasks_;
121
122 scoped_ptr<Task> notify_repaint_task_; 110 scoped_ptr<Task> notify_repaint_task_;
123 111
124 scoped_ptr<Callback0::Type> swap_buffers_callback_; 112 scoped_ptr<Callback0::Type> swap_buffers_callback_;
125 scoped_ptr<Callback0::Type> channel_error_callback_; 113 scoped_ptr<Callback0::Type> channel_error_callback_;
126 114
127 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxy); 115 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxy);
128 }; 116 };
129 117
130 #endif // ENABLE_GPU 118 #endif // ENABLE_GPU
131 119
132 #endif // CONTENT_RENDERER_COMMAND_BUFFER_PROXY_H_ 120 #endif // CONTENT_RENDERER_COMMAND_BUFFER_PROXY_H_
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_messages.h ('k') | content/renderer/command_buffer_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698