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

Side by Side Diff: content/browser/gpu/gpu_process_host_ui_shim.cc

Issue 2267843002: gpu host: Delete GpuMsg_Finalize (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 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
« no previous file with comments | « content/browser/gpu/gpu_process_host_ui_shim.h ('k') | content/common/gpu_host_messages.h » ('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) 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 #include "content/browser/gpu/gpu_process_host_ui_shim.h" 5 #include "content/browser/gpu/gpu_process_host_ui_shim.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 LAZY_INSTANCE_INITIALIZER; 44 LAZY_INSTANCE_INITIALIZER;
45 45
46 void SendOnIOThreadTask(int host_id, IPC::Message* msg) { 46 void SendOnIOThreadTask(int host_id, IPC::Message* msg) {
47 GpuProcessHost* host = GpuProcessHost::FromID(host_id); 47 GpuProcessHost* host = GpuProcessHost::FromID(host_id);
48 if (host) 48 if (host)
49 host->Send(msg); 49 host->Send(msg);
50 else 50 else
51 delete msg; 51 delete msg;
52 } 52 }
53 53
54 void StopGpuProcessOnIO(int host_id) {
55 GpuProcessHost* host = GpuProcessHost::FromID(host_id);
56 if (host)
57 host->StopGpuProcess();
58 }
59
60 } // namespace 54 } // namespace
61 55
62 void RouteToGpuProcessHostUIShimTask(int host_id, const IPC::Message& msg) { 56 void RouteToGpuProcessHostUIShimTask(int host_id, const IPC::Message& msg) {
63 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(host_id); 57 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(host_id);
64 if (ui_shim) 58 if (ui_shim)
65 ui_shim->OnMessageReceived(msg); 59 ui_shim->OnMessageReceived(msg);
66 } 60 }
67 61
68 GpuProcessHostUIShim::GpuProcessHostUIShim(int host_id) 62 GpuProcessHostUIShim::GpuProcessHostUIShim(int host_id)
69 : host_id_(host_id) { 63 : host_id_(host_id) {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 ->OnMessageReceived(message)) 136 ->OnMessageReceived(message))
143 return true; 137 return true;
144 #endif 138 #endif
145 139
146 if (message.routing_id() != MSG_ROUTING_CONTROL) 140 if (message.routing_id() != MSG_ROUTING_CONTROL)
147 return false; 141 return false;
148 142
149 return OnControlMessageReceived(message); 143 return OnControlMessageReceived(message);
150 } 144 }
151 145
152 void GpuProcessHostUIShim::StopGpuProcess(const base::Closure& callback) {
153 close_callback_ = callback;
154
155 BrowserThread::PostTask(
156 BrowserThread::IO, FROM_HERE, base::Bind(&StopGpuProcessOnIO, host_id_));
157 }
158
159 void GpuProcessHostUIShim::SimulateRemoveAllContext() { 146 void GpuProcessHostUIShim::SimulateRemoveAllContext() {
160 Send(new GpuMsg_Clean()); 147 Send(new GpuMsg_Clean());
161 } 148 }
162 149
163 void GpuProcessHostUIShim::SimulateCrash() { 150 void GpuProcessHostUIShim::SimulateCrash() {
164 Send(new GpuMsg_Crash()); 151 Send(new GpuMsg_Crash());
165 } 152 }
166 153
167 void GpuProcessHostUIShim::SimulateHang() { 154 void GpuProcessHostUIShim::SimulateHang() {
168 Send(new GpuMsg_Hang()); 155 Send(new GpuMsg_Hang());
169 } 156 }
170 157
171 GpuProcessHostUIShim::~GpuProcessHostUIShim() { 158 GpuProcessHostUIShim::~GpuProcessHostUIShim() {
172 DCHECK(CalledOnValidThread()); 159 DCHECK(CalledOnValidThread());
173 if (!close_callback_.is_null())
174 base::ResetAndReturn(&close_callback_).Run();
175 g_hosts_by_id.Pointer()->Remove(host_id_); 160 g_hosts_by_id.Pointer()->Remove(host_id_);
176 } 161 }
177 162
178 bool GpuProcessHostUIShim::OnControlMessageReceived( 163 bool GpuProcessHostUIShim::OnControlMessageReceived(
179 const IPC::Message& message) { 164 const IPC::Message& message) {
180 DCHECK(CalledOnValidThread()); 165 DCHECK(CalledOnValidThread());
181 166
182 IPC_BEGIN_MESSAGE_MAP(GpuProcessHostUIShim, message) 167 IPC_BEGIN_MESSAGE_MAP(GpuProcessHostUIShim, message)
183 IPC_MESSAGE_HANDLER(GpuHostMsg_OnLogMessage, OnLogMessage) 168 IPC_MESSAGE_HANDLER(GpuHostMsg_OnLogMessage, OnLogMessage)
184 IPC_MESSAGE_HANDLER(GpuHostMsg_GraphicsInfoCollected, 169 IPC_MESSAGE_HANDLER(GpuHostMsg_GraphicsInfoCollected,
(...skipping 24 matching lines...) Expand all
209 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info); 194 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info);
210 } 195 }
211 196
212 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( 197 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived(
213 const gpu::VideoMemoryUsageStats& video_memory_usage_stats) { 198 const gpu::VideoMemoryUsageStats& video_memory_usage_stats) {
214 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( 199 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats(
215 video_memory_usage_stats); 200 video_memory_usage_stats);
216 } 201 }
217 202
218 } // namespace content 203 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_process_host_ui_shim.h ('k') | content/common/gpu_host_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698