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

Side by Side Diff: content/gpu/gpu_channel.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/content_gpu_client.h ('k') | content/gpu/gpu_channel.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_CHANNEL_H_
6 #define CONTENT_GPU_GPU_CHANNEL_H_
7 #pragma once
8
9 #include <set>
10 #include <string>
11 #include <vector>
12
13 #include "base/id_map.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "base/process.h"
16 #include "build/build_config.h"
17 #include "content/common/message_router.h"
18 #include "content/gpu/gpu_command_buffer_stub.h"
19 #include "ipc/ipc_sync_channel.h"
20 #include "ui/gfx/native_widget_types.h"
21 #include "ui/gfx/size.h"
22
23 class GpuRenderThread;
24 class GpuWatchdogThread;
25 struct GPUCreateCommandBufferConfig;
26 class MessageLoop;
27
28 namespace base {
29 class WaitableEvent;
30 }
31
32 // Encapsulates an IPC channel between the GPU process and one renderer
33 // process. On the renderer side there's a corresponding GpuChannelHost.
34 class GpuChannel : public IPC::Channel::Listener,
35 public IPC::Message::Sender,
36 public base::RefCountedThreadSafe<GpuChannel> {
37 public:
38 // Takes ownership of the renderer process handle.
39 GpuChannel(GpuRenderThread* gpu_render_thread,
40 GpuWatchdogThread* gpu_watchdog_thread,
41 int renderer_id);
42 virtual ~GpuChannel();
43
44 bool Init(MessageLoop* io_message_loop, base::WaitableEvent* shutdown_event);
45
46 // Get the GpuThread that owns this channel.
47 GpuRenderThread* gpu_render_thread() const { return gpu_render_thread_; }
48
49 // Returns the name of the associated IPC channel.
50 std::string GetChannelName();
51
52 #if defined(OS_POSIX)
53 int GetRendererFileDescriptor();
54 #endif // defined(OS_POSIX)
55
56 base::ProcessHandle renderer_process() const {
57 return renderer_process_;
58 }
59
60 // IPC::Channel::Listener implementation:
61 virtual bool OnMessageReceived(const IPC::Message& msg);
62 virtual void OnChannelError();
63 virtual void OnChannelConnected(int32 peer_pid);
64
65 // IPC::Message::Sender implementation:
66 virtual bool Send(IPC::Message* msg);
67
68 void CreateViewCommandBuffer(
69 gfx::PluginWindowHandle window,
70 int32 render_view_id,
71 const GPUCreateCommandBufferConfig& init_params,
72 int32* route_id);
73
74 #if defined(OS_MACOSX)
75 virtual void AcceleratedSurfaceBuffersSwapped(
76 int32 route_id, uint64 swap_buffers_count);
77 void DestroyCommandBufferByViewId(int32 render_view_id);
78 #endif
79
80 private:
81 bool OnControlMessageReceived(const IPC::Message& msg);
82
83 int GenerateRouteID();
84
85 // Message handlers.
86 void OnInitialize(base::ProcessHandle renderer_process);
87 void OnCreateOffscreenCommandBuffer(
88 int32 parent_route_id,
89 const gfx::Size& size,
90 const GPUCreateCommandBufferConfig& init_params,
91 uint32 parent_texture_id,
92 int32* route_id);
93 void OnDestroyCommandBuffer(int32 route_id);
94
95 void OnCreateVideoDecoder(int32 context_route_id,
96 int32 decoder_host_id);
97 void OnDestroyVideoDecoder(int32 decoder_id);
98
99 // The lifetime of objects of this class is managed by a GpuRenderThread. The
100 // GpuRenderThreads destroy all the GpuChannels that they own when they
101 // are destroyed. So a raw pointer is safe.
102 GpuRenderThread* gpu_render_thread_;
103
104 scoped_ptr<IPC::SyncChannel> channel_;
105
106 // The id of the renderer who is on the other side of the channel.
107 int renderer_id_;
108
109 // Handle to the renderer process that is on the other side of the channel.
110 base::ProcessHandle renderer_process_;
111
112 // The process id of the renderer process.
113 base::ProcessId renderer_pid_;
114
115 // Used to implement message routing functionality to CommandBuffer objects
116 MessageRouter router_;
117
118 #if defined(ENABLE_GPU)
119 typedef IDMap<GpuCommandBufferStub, IDMapOwnPointer> StubMap;
120 StubMap stubs_;
121 #endif // defined (ENABLE_GPU)
122
123 bool log_messages_; // True if we should log sent and received messages.
124 gpu::gles2::DisallowedExtensions disallowed_extensions_;
125 GpuWatchdogThread* watchdog_thread_;
126
127 DISALLOW_COPY_AND_ASSIGN(GpuChannel);
128 };
129
130 #endif // CONTENT_GPU_GPU_CHANNEL_H_
OLDNEW
« no previous file with comments | « content/gpu/content_gpu_client.h ('k') | content/gpu/gpu_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698