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

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

Issue 6793054: Moved code that runs in both the browser and GPU process from content/gpu to content/common/gpu. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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/gpu/gpu_child_thread.cc ('k') | content/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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_GPU_GPU_COMMAND_BUFFER_STUB_H_
6 #define CONTENT_GPU_GPU_COMMAND_BUFFER_STUB_H_
7 #pragma once
8
9 #if defined(ENABLE_GPU)
10
11 #include <vector>
12 #include <string>
13
14 #include "base/memory/weak_ptr.h"
15 #include "base/process.h"
16 #include "gpu/command_buffer/service/command_buffer_service.h"
17 #include "gpu/command_buffer/service/gpu_processor.h"
18 #include "ipc/ipc_channel.h"
19 #include "ipc/ipc_message.h"
20 #include "ui/gfx/native_widget_types.h"
21 #include "ui/gfx/size.h"
22
23 class GpuChannel;
24 class GpuWatchdogThread;
25
26 class GpuCommandBufferStub
27 : public IPC::Channel::Listener,
28 public IPC::Message::Sender,
29 public base::SupportsWeakPtr<GpuCommandBufferStub> {
30 public:
31 GpuCommandBufferStub(
32 GpuChannel* channel,
33 gfx::PluginWindowHandle handle,
34 GpuCommandBufferStub* parent,
35 const gfx::Size& size,
36 const gpu::gles2::DisallowedExtensions& disallowed_extensions,
37 const std::string& allowed_extensions,
38 const std::vector<int32>& attribs,
39 uint32 parent_texture_id,
40 int32 route_id,
41 int32 renderer_id,
42 int32 render_view_id,
43 GpuWatchdogThread* gpu_watchdog_thread);
44
45 virtual ~GpuCommandBufferStub();
46
47 // IPC::Channel::Listener implementation:
48 virtual bool OnMessageReceived(const IPC::Message& message);
49
50 // IPC::Message::Sender implementation:
51 virtual bool Send(IPC::Message* msg);
52
53 // Get the GLContext associated with this object.
54 gpu::GPUProcessor* processor() const { return processor_.get(); }
55
56 // Identifies the renderer process.
57 int32 renderer_id() const { return renderer_id_; }
58
59 // Identifies a particular renderer belonging to the same renderer process.
60 int32 render_view_id() const { return render_view_id_; }
61
62 // Identifies the various GpuCommandBufferStubs in the GPU process belonging
63 // to the same renderer process.
64 int32 route_id() const { return route_id_; }
65
66 #if defined(OS_WIN)
67 // Called only by the compositor window's window proc
68 void OnCompositorWindowPainted();
69 #endif // defined(OS_WIN)
70
71 #if defined(OS_MACOSX)
72 // Called only by the GpuChannel.
73 void AcceleratedSurfaceBuffersSwapped(uint64 swap_buffers_count);
74 #endif // defined(OS_MACOSX)
75
76 private:
77 // Message handlers:
78 void OnInitialize(base::SharedMemoryHandle ring_buffer,
79 int32 size,
80 bool* result);
81 void OnGetState(gpu::CommandBuffer::State* state);
82 void OnAsyncGetState();
83 void OnFlush(int32 put_offset, gpu::CommandBuffer::State* state);
84 void OnAsyncFlush(int32 put_offset);
85 void OnCreateTransferBuffer(int32 size, int32* id);
86 void OnRegisterTransferBuffer(base::SharedMemoryHandle transfer_buffer,
87 size_t size,
88 int32* id);
89 void OnDestroyTransferBuffer(int32 id);
90 void OnGetTransferBuffer(int32 id,
91 base::SharedMemoryHandle* transfer_buffer,
92 uint32* size);
93 void OnResizeOffscreenFrameBuffer(const gfx::Size& size);
94
95 void OnSwapBuffers();
96 void OnCommandProcessed();
97
98 #if defined(OS_MACOSX)
99 void OnSetWindowSize(const gfx::Size& size);
100 void SwapBuffersCallback();
101 #endif // defined(OS_MACOSX)
102
103 #if defined(OS_WIN)
104 bool CreateCompositorWindow();
105 #endif // defined(OS_WIN)
106
107 void ResizeCallback(gfx::Size size);
108
109 // The lifetime of objects of this class is managed by a GpuChannel. The
110 // GpuChannels destroy all the GpuCommandBufferStubs that they own when they
111 // are destroyed. So a raw pointer is safe.
112 GpuChannel* channel_;
113
114 gfx::PluginWindowHandle handle_;
115 base::WeakPtr<GpuCommandBufferStub> parent_;
116 gfx::Size initial_size_;
117 gpu::gles2::DisallowedExtensions disallowed_extensions_;
118 std::string allowed_extensions_;
119 std::vector<int32> requested_attribs_;
120 uint32 parent_texture_id_;
121 int32 route_id_;
122
123 #if defined(OS_WIN)
124 HWND compositor_window_;
125 #endif // defined(OS_WIN)
126
127 // The following two fields are used on Mac OS X to identify the window
128 // for the rendering results on the browser side.
129 int32 renderer_id_;
130 int32 render_view_id_;
131
132 scoped_ptr<gpu::CommandBufferService> command_buffer_;
133 scoped_ptr<gpu::GPUProcessor> processor_;
134 GpuWatchdogThread* watchdog_thread_;
135
136 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub);
137 };
138
139 #endif // defined(ENABLE_GPU)
140
141 #endif // CONTENT_GPU_GPU_COMMAND_BUFFER_STUB_H_
OLDNEW
« no previous file with comments | « content/gpu/gpu_child_thread.cc ('k') | content/gpu/gpu_command_buffer_stub.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698