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

Side by Side Diff: chrome/browser/gpu_process_host_ui_shim.h

Issue 6557006: Moved creation of GPU transfer buffers into the browser process.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 CHROME_BROWSER_GPU_PROCESS_HOST_UI_SHIM_H_ 5 #ifndef CHROME_BROWSER_GPU_PROCESS_HOST_UI_SHIM_H_
6 #define CHROME_BROWSER_GPU_PROCESS_HOST_UI_SHIM_H_ 6 #define CHROME_BROWSER_GPU_PROCESS_HOST_UI_SHIM_H_
7 #pragma once 7 #pragma once
8 8
9 // This class lives on the UI thread and supports classes like the 9 // This class lives on the UI thread and supports classes like the
10 // BackingStoreProxy, which must live on the UI thread. The IO thread 10 // BackingStoreProxy, which must live on the UI thread. The IO thread
11 // portion of this class, the GpuProcessHost, is responsible for 11 // portion of this class, the GpuProcessHost, is responsible for
12 // shuttling messages between the browser and GPU processes. 12 // shuttling messages between the browser and GPU processes.
13 13
14 #include <map> 14 #include <map>
15 #include <queue> 15 #include <queue>
16 16
17 #include "base/callback.h" 17 #include "base/callback.h"
18 #include "base/linked_ptr.h" 18 #include "base/linked_ptr.h"
19 #include "base/process.h"
19 #include "base/scoped_ptr.h" 20 #include "base/scoped_ptr.h"
20 #include "base/singleton.h" 21 #include "base/singleton.h"
21 #include "base/values.h" 22 #include "base/values.h"
22 #include "base/threading/non_thread_safe.h" 23 #include "base/threading/non_thread_safe.h"
23 #include "chrome/common/gpu_feature_flags.h" 24 #include "chrome/common/gpu_feature_flags.h"
24 #include "chrome/common/gpu_info.h" 25 #include "chrome/common/gpu_info.h"
25 #include "chrome/common/message_router.h" 26 #include "chrome/common/message_router.h"
26 #include "ipc/ipc_channel.h" 27 #include "ipc/ipc_channel.h"
27 #include "ui/gfx/native_widget_types.h" 28 #include "ui/gfx/native_widget_types.h"
28 29
(...skipping 22 matching lines...) Expand all
51 // Returns null on failure. It is not safe to store the pointer once control 52 // Returns null on failure. It is not safe to store the pointer once control
52 // has returned to the message loop as it can be destroyed. Instead store the 53 // has returned to the message loop as it can be destroyed. Instead store the
53 // associated GPU host ID. A renderer ID of zero means the browser process. 54 // associated GPU host ID. A renderer ID of zero means the browser process.
54 static GpuProcessHostUIShim* GetForRenderer(int renderer_id); 55 static GpuProcessHostUIShim* GetForRenderer(int renderer_id);
55 56
56 // Destroy the GpuProcessHostUIShim with the given host ID. This can only 57 // Destroy the GpuProcessHostUIShim with the given host ID. This can only
57 // be called on the UI thread. Only the GpuProcessHost should destroy the 58 // be called on the UI thread. Only the GpuProcessHost should destroy the
58 // UI shim. 59 // UI shim.
59 static void Destroy(int host_id); 60 static void Destroy(int host_id);
60 61
62 // The GPU process is launched asynchronously. If it launches successfully,
63 // this function is called on the UI thread with the process handle. On
64 // Windows, the UI shim takes ownership of the handle.
65 static void NotifyGpuProcessLaunched(int host_id,
66 base::ProcessHandle gpu_process);
67
61 static GpuProcessHostUIShim* FromID(int host_id); 68 static GpuProcessHostUIShim* FromID(int host_id);
62 int host_id() const { return host_id_; } 69 int host_id() const { return host_id_; }
63 70
64 // IPC::Channel::Sender implementation. 71 // IPC::Channel::Sender implementation.
65 virtual bool Send(IPC::Message* msg); 72 virtual bool Send(IPC::Message* msg);
66 73
67 // Sends outstanding replies. This is only called 74 // Sends outstanding replies. This is only called
68 // in error situations like the GPU process crashing -- but is necessary 75 // in error situations like the GPU process crashing -- but is necessary
69 // to prevent the blocked clients from hanging. 76 // to prevent the blocked clients from hanging.
70 void SendOutstandingReplies(); 77 void SendOutstandingReplies();
71 78
72 // IPC::Channel::Listener implementation. 79 // IPC::Channel::Listener implementation.
73 // The GpuProcessHost causes this to be called on the UI thread to 80 // The GpuProcessHost causes this to be called on the UI thread to
74 // dispatch the incoming messages from the GPU process, which are 81 // dispatch the incoming messages from the GPU process, which are
75 // actually received on the IO thread. 82 // actually received on the IO thread.
76 virtual bool OnMessageReceived(const IPC::Message& message); 83 virtual bool OnMessageReceived(const IPC::Message& message);
77 84
78 typedef Callback2<const IPC::ChannelHandle&, const GPUInfo&>::Type 85 typedef Callback3<const IPC::ChannelHandle&,
86 base::ProcessHandle,
87 const GPUInfo&>::Type
79 EstablishChannelCallback; 88 EstablishChannelCallback;
80 89
81 // Tells the GPU process to create a new channel for communication with a 90 // Tells the GPU process to create a new channel for communication with a
82 // renderer. Once the GPU process responds asynchronously with the IPC handle 91 // renderer. Once the GPU process responds asynchronously with the IPC handle
83 // and GPUInfo, we call the callback. 92 // and GPUInfo, we call the callback.
84 void EstablishGpuChannel( 93 void EstablishGpuChannel(
85 int renderer_id, EstablishChannelCallback* callback); 94 int renderer_id, EstablishChannelCallback* callback);
86 95
87 typedef Callback0::Type SynchronizeCallback; 96 typedef Callback0::Type SynchronizeCallback;
88 97
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 const GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params& params); 169 const GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params& params);
161 void OnAcceleratedSurfaceBuffersSwapped( 170 void OnAcceleratedSurfaceBuffersSwapped(
162 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params); 171 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params);
163 #elif defined(OS_WIN) 172 #elif defined(OS_WIN)
164 void OnScheduleComposite(int32 renderer_id, int32 render_view_id); 173 void OnScheduleComposite(int32 renderer_id, int32 render_view_id);
165 #endif 174 #endif
166 175
167 // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair. 176 // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair.
168 int host_id_; 177 int host_id_;
169 178
179 // The handle for the GPU process or null if it is not known to be launched.
180 base::ProcessHandle gpu_process_;
181
170 GPUInfo gpu_info_; 182 GPUInfo gpu_info_;
171 ListValue log_messages_; 183 ListValue log_messages_;
172 184
173 // Used only in testing. If set, the callback is invoked when the GPU info 185 // Used only in testing. If set, the callback is invoked when the GPU info
174 // has been collected. 186 // has been collected.
175 scoped_ptr<Callback0::Type> gpu_info_collected_callback_; 187 scoped_ptr<Callback0::Type> gpu_info_collected_callback_;
176 188
177 // These are the channel requests that we have already sent to 189 // These are the channel requests that we have already sent to
178 // the GPU process, but haven't heard back about yet. 190 // the GPU process, but haven't heard back about yet.
179 std::queue<linked_ptr<EstablishChannelCallback> > channel_requests_; 191 std::queue<linked_ptr<EstablishChannelCallback> > channel_requests_;
(...skipping 14 matching lines...) Expand all
194 class ViewSurface; 206 class ViewSurface;
195 std::map<ViewID, linked_ptr<ViewSurface> > acquired_surfaces_; 207 std::map<ViewID, linked_ptr<ViewSurface> > acquired_surfaces_;
196 208
197 bool gpu_feature_flags_set_; 209 bool gpu_feature_flags_set_;
198 scoped_ptr<GpuBlacklist> gpu_blacklist_; 210 scoped_ptr<GpuBlacklist> gpu_blacklist_;
199 GpuFeatureFlags gpu_feature_flags_; 211 GpuFeatureFlags gpu_feature_flags_;
200 }; 212 };
201 213
202 #endif // CHROME_BROWSER_GPU_PROCESS_HOST_UI_SHIM_H_ 214 #endif // CHROME_BROWSER_GPU_PROCESS_HOST_UI_SHIM_H_
203 215
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698