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

Side by Side Diff: content/browser/gpu/gpu_process_host.h

Issue 9958034: Convert plugin and GPU process to brokered handle duplication. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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
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_BROWSER_GPU_GPU_PROCESS_HOST_H_ 5 #ifndef CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_
6 #define CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ 6 #define CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <queue> 10 #include <queue>
(...skipping 21 matching lines...) Expand all
32 class GpuProcessHost : public content::BrowserChildProcessHostDelegate, 32 class GpuProcessHost : public content::BrowserChildProcessHostDelegate,
33 public IPC::Message::Sender, 33 public IPC::Message::Sender,
34 public base::NonThreadSafe { 34 public base::NonThreadSafe {
35 public: 35 public:
36 enum GpuProcessKind { 36 enum GpuProcessKind {
37 GPU_PROCESS_KIND_UNSANDBOXED, 37 GPU_PROCESS_KIND_UNSANDBOXED,
38 GPU_PROCESS_KIND_SANDBOXED 38 GPU_PROCESS_KIND_SANDBOXED
39 }; 39 };
40 40
41 typedef base::Callback<void(const IPC::ChannelHandle&, 41 typedef base::Callback<void(const IPC::ChannelHandle&,
42 base::ProcessHandle,
43 const content::GPUInfo&)> 42 const content::GPUInfo&)>
44 EstablishChannelCallback; 43 EstablishChannelCallback;
45 44
46 typedef base::Callback<void(int32)> CreateCommandBufferCallback; 45 typedef base::Callback<void(int32)> CreateCommandBufferCallback;
47 46
48 static bool gpu_enabled() { return gpu_enabled_; } 47 static bool gpu_enabled() { return gpu_enabled_; }
49 48
50 // Creates a new GpuProcessHost or gets an existing one, resulting in the 49 // Creates a new GpuProcessHost or gets an existing one, resulting in the
51 // launching of a GPU process if required. Returns null on failure. It 50 // launching of a GPU process if required. Returns null on failure. It
52 // is not safe to store the pointer once control has returned to the message 51 // is not safe to store the pointer once control has returned to the message
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 virtual ~GpuProcessHost(); 100 virtual ~GpuProcessHost();
102 101
103 bool Init(); 102 bool Init();
104 103
105 // Post an IPC message to the UI shim's message handler on the UI thread. 104 // Post an IPC message to the UI shim's message handler on the UI thread.
106 void RouteOnUIThread(const IPC::Message& message); 105 void RouteOnUIThread(const IPC::Message& message);
107 106
108 // BrowserChildProcessHostDelegate implementation. 107 // BrowserChildProcessHostDelegate implementation.
109 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 108 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
110 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; 109 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
111 virtual void OnProcessLaunched() OVERRIDE;
112 virtual void OnProcessCrashed(int exit_code) OVERRIDE; 110 virtual void OnProcessCrashed(int exit_code) OVERRIDE;
113 111
114 // Message handlers. 112 // Message handlers.
115 void OnChannelEstablished(const IPC::ChannelHandle& channel_handle); 113 void OnChannelEstablished(const IPC::ChannelHandle& channel_handle);
116 void OnCommandBufferCreated(const int32 route_id); 114 void OnCommandBufferCreated(const int32 route_id);
117 void OnDestroyCommandBuffer(int32 surface_id); 115 void OnDestroyCommandBuffer(int32 surface_id);
118 116
119 #if defined(OS_WIN) && !defined(USE_AURA) 117 #if defined(OS_WIN) && !defined(USE_AURA)
120 void OnAcceleratedSurfaceBuffersSwapped( 118 void OnAcceleratedSurfaceBuffersSwapped(
121 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params); 119 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 // Multimap is used to simulate reference counting, see comment in 154 // Multimap is used to simulate reference counting, see comment in
157 // GpuProcessHostUIShim::CreateViewCommandBuffer. 155 // GpuProcessHostUIShim::CreateViewCommandBuffer.
158 class SurfaceRef; 156 class SurfaceRef;
159 typedef std::multimap<int, linked_ptr<SurfaceRef> > SurfaceRefMap; 157 typedef std::multimap<int, linked_ptr<SurfaceRef> > SurfaceRefMap;
160 SurfaceRefMap surface_refs_; 158 SurfaceRefMap surface_refs_;
161 #endif 159 #endif
162 160
163 // Qeueud messages to send when the process launches. 161 // Qeueud messages to send when the process launches.
164 std::queue<IPC::Message*> queued_messages_; 162 std::queue<IPC::Message*> queued_messages_;
165 163
166 // The handle for the GPU process or null if it is not known to be launched.
167 base::ProcessHandle gpu_process_;
168
169 // Whether we are running a GPU thread inside the browser process instead 164 // Whether we are running a GPU thread inside the browser process instead
170 // of a separate GPU process. 165 // of a separate GPU process.
171 bool in_process_; 166 bool in_process_;
172 167
173 bool software_rendering_; 168 bool software_rendering_;
174 GpuProcessKind kind_; 169 GpuProcessKind kind_;
175 170
176 scoped_ptr<GpuMainThread> in_process_gpu_thread_; 171 scoped_ptr<GpuMainThread> in_process_gpu_thread_;
177 172
178 // Whether we actually launched a GPU process. 173 // Whether we actually launched a GPU process.
179 bool process_launched_; 174 bool process_launched_;
180 175
181 // Master switch for enabling/disabling GPU acceleration for the current 176 // Master switch for enabling/disabling GPU acceleration for the current
182 // browser session. It does not change the acceleration settings for 177 // browser session. It does not change the acceleration settings for
183 // existing tabs, just the future ones. 178 // existing tabs, just the future ones.
184 static bool gpu_enabled_; 179 static bool gpu_enabled_;
185 180
186 static bool hardware_gpu_enabled_; 181 static bool hardware_gpu_enabled_;
187 182
188 scoped_ptr<BrowserChildProcessHostImpl> process_; 183 scoped_ptr<BrowserChildProcessHostImpl> process_;
189 184
190 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); 185 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost);
191 }; 186 };
192 187
193 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ 188 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698