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

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

Issue 8887001: Remove custom Task implementations and re-exorcise old callbacks from gpu. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: base::IgnoreResult instead of base::IgnoreReturn Created 9 years 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 | « no previous file | content/browser/gpu/gpu_process_host.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_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>
11 11
12 #include "base/callback_old.h" 12 #include "base/callback.h"
13 #include "base/memory/linked_ptr.h" 13 #include "base/memory/linked_ptr.h"
14 #include "base/threading/non_thread_safe.h" 14 #include "base/threading/non_thread_safe.h"
15 #include "content/browser/browser_child_process_host.h" 15 #include "content/browser/browser_child_process_host.h"
16 #include "content/common/content_export.h" 16 #include "content/common/content_export.h"
17 #include "content/common/gpu/gpu_process_launch_causes.h" 17 #include "content/common/gpu/gpu_process_launch_causes.h"
18 #include "content/public/common/gpu_info.h" 18 #include "content/public/common/gpu_info.h"
19 #include "ui/gfx/native_widget_types.h" 19 #include "ui/gfx/native_widget_types.h"
20 20
21 struct GPUCreateCommandBufferConfig; 21 struct GPUCreateCommandBufferConfig;
22 22
(...skipping 28 matching lines...) Expand all
51 // null if the process no longer exists. 51 // null if the process no longer exists.
52 static GpuProcessHost* FromID(int host_id); 52 static GpuProcessHost* FromID(int host_id);
53 int host_id() const { return host_id_; } 53 int host_id() const { return host_id_; }
54 54
55 virtual bool Send(IPC::Message* msg) OVERRIDE; 55 virtual bool Send(IPC::Message* msg) OVERRIDE;
56 56
57 // ChildProcessHost implementation. 57 // ChildProcessHost implementation.
58 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 58 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
59 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; 59 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
60 60
61 typedef Callback3<const IPC::ChannelHandle&, 61 typedef base::Callback<void(const IPC::ChannelHandle&,
62 base::ProcessHandle, 62 base::ProcessHandle,
63 const content::GPUInfo&>::Type 63 const content::GPUInfo&)>
64 EstablishChannelCallback; 64 EstablishChannelCallback;
65 65
66 // Tells the GPU process to create a new channel for communication with a 66 // Tells the GPU process to create a new channel for communication with a
67 // renderer. Once the GPU process responds asynchronously with the IPC handle 67 // renderer. Once the GPU process responds asynchronously with the IPC handle
68 // and GPUInfo, we call the callback. 68 // and GPUInfo, we call the callback.
69 void EstablishGpuChannel( 69 void EstablishGpuChannel(
70 int renderer_id, EstablishChannelCallback* callback); 70 int renderer_id, const EstablishChannelCallback& callback);
71 71
72 typedef Callback1<int32>::Type CreateCommandBufferCallback; 72 typedef base::Callback<void(int32)> CreateCommandBufferCallback;
73 73
74 // Tells the GPU process to create a new command buffer that draws into the 74 // Tells the GPU process to create a new command buffer that draws into the
75 // window associated with the given renderer. 75 // window associated with the given renderer.
76 void CreateViewCommandBuffer( 76 void CreateViewCommandBuffer(
77 gfx::PluginWindowHandle compositing_surface, 77 gfx::PluginWindowHandle compositing_surface,
78 int32 render_view_id, 78 int32 render_view_id,
79 int32 renderer_id, 79 int32 renderer_id,
80 const GPUCreateCommandBufferConfig& init_params, 80 const GPUCreateCommandBufferConfig& init_params,
81 CreateCommandBufferCallback* callback); 81 const CreateCommandBufferCallback& callback);
82 82
83 // Whether this GPU process is set up to use software rendering. 83 // Whether this GPU process is set up to use software rendering.
84 bool software_rendering(); 84 bool software_rendering();
85 85
86 void ForceShutdown(); 86 void ForceShutdown();
87 87
88 private: 88 private:
89 GpuProcessHost(int host_id); 89 GpuProcessHost(int host_id);
90 virtual ~GpuProcessHost(); 90 virtual ~GpuProcessHost();
91 91
92 bool Init(); 92 bool Init();
93 93
94 // Post an IPC message to the UI shim's message handler on the UI thread. 94 // Post an IPC message to the UI shim's message handler on the UI thread.
95 void RouteOnUIThread(const IPC::Message& message); 95 void RouteOnUIThread(const IPC::Message& message);
96 96
97 virtual void OnProcessLaunched() OVERRIDE; 97 virtual void OnProcessLaunched() OVERRIDE;
98 virtual void OnProcessCrashed(int exit_code) OVERRIDE; 98 virtual void OnProcessCrashed(int exit_code) OVERRIDE;
99 99
100 // Message handlers. 100 // Message handlers.
101 void OnChannelEstablished(const IPC::ChannelHandle& channel_handle); 101 void OnChannelEstablished(const IPC::ChannelHandle& channel_handle);
102 void OnCommandBufferCreated(const int32 route_id); 102 void OnCommandBufferCreated(const int32 route_id);
103 void OnDestroyCommandBuffer( 103 void OnDestroyCommandBuffer(
104 gfx::PluginWindowHandle window, int32 renderer_id, int32 render_view_id); 104 gfx::PluginWindowHandle window, int32 renderer_id, int32 render_view_id);
105 void OnGraphicsInfoCollected(const content::GPUInfo& gpu_info); 105 void OnGraphicsInfoCollected(const content::GPUInfo& gpu_info);
106 106
107 bool LaunchGpuProcess(const std::string& channel_id); 107 bool LaunchGpuProcess(const std::string& channel_id);
108 108
109 void SendOutstandingReplies(); 109 void SendOutstandingReplies();
110 void EstablishChannelError( 110 void EstablishChannelError(
111 EstablishChannelCallback* callback, 111 const EstablishChannelCallback& callback,
112 const IPC::ChannelHandle& channel_handle, 112 const IPC::ChannelHandle& channel_handle,
113 base::ProcessHandle renderer_process_for_gpu, 113 base::ProcessHandle renderer_process_for_gpu,
114 const content::GPUInfo& gpu_info); 114 const content::GPUInfo& gpu_info);
115 void CreateCommandBufferError(CreateCommandBufferCallback* callback, 115 void CreateCommandBufferError(const CreateCommandBufferCallback& callback,
116 int32 route_id); 116 int32 route_id);
117 117
118 // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair. 118 // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair.
119 int host_id_; 119 int host_id_;
120 120
121 // These are the channel requests that we have already sent to 121 // These are the channel requests that we have already sent to
122 // the GPU process, but haven't heard back about yet. 122 // the GPU process, but haven't heard back about yet.
123 std::queue<linked_ptr<EstablishChannelCallback> > channel_requests_; 123 std::queue<EstablishChannelCallback> channel_requests_;
124 124
125 // The pending create command buffer requests we need to reply to. 125 // The pending create command buffer requests we need to reply to.
126 std::queue<linked_ptr<CreateCommandBufferCallback> > 126 std::queue<CreateCommandBufferCallback> create_command_buffer_requests_;
127 create_command_buffer_requests_;
128 127
129 #if defined(TOOLKIT_USES_GTK) 128 #if defined(TOOLKIT_USES_GTK)
130 typedef std::pair<int32 /* renderer_id */, 129 typedef std::pair<int32 /* renderer_id */,
131 int32 /* render_view_id */> ViewID; 130 int32 /* render_view_id */> ViewID;
132 131
133 // Encapsulates surfaces that we lock when creating view command buffers. 132 // Encapsulates surfaces that we lock when creating view command buffers.
134 // We release this lock once the command buffer (or associated GPU process) 133 // We release this lock once the command buffer (or associated GPU process)
135 // is destroyed. This prevents the browser from destroying the surface 134 // is destroyed. This prevents the browser from destroying the surface
136 // while the GPU process is drawing to it. 135 // while the GPU process is drawing to it.
137 136
(...skipping 20 matching lines...) Expand all
158 157
159 // Master switch for enabling/disabling GPU acceleration for the current 158 // Master switch for enabling/disabling GPU acceleration for the current
160 // browser session. It does not change the acceleration settings for 159 // browser session. It does not change the acceleration settings for
161 // existing tabs, just the future ones. 160 // existing tabs, just the future ones.
162 CONTENT_EXPORT static bool gpu_enabled_; 161 CONTENT_EXPORT static bool gpu_enabled_;
163 162
164 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); 163 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost);
165 }; 164 };
166 165
167 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ 166 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/gpu/gpu_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698