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

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

Issue 10891013: Make GpuDataManager thread safe. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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 | 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 #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/command_line.h" 10 #include "base/command_line.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 } 173 }
174 174
175 void GpuProcessHostUIShim::SimulateHang() { 175 void GpuProcessHostUIShim::SimulateHang() {
176 Send(new GpuMsg_Hang()); 176 Send(new GpuMsg_Hang());
177 } 177 }
178 178
179 GpuProcessHostUIShim::~GpuProcessHostUIShim() { 179 GpuProcessHostUIShim::~GpuProcessHostUIShim() {
180 DCHECK(CalledOnValidThread()); 180 DCHECK(CalledOnValidThread());
181 g_hosts_by_id.Pointer()->Remove(host_id_); 181 g_hosts_by_id.Pointer()->Remove(host_id_);
182 182
183 DictionaryValue* dict = new DictionaryValue(); 183 GpuDataManagerImpl::GetInstance()->AddLogMessage(
184 dict->SetInteger("level", logging::LOG_ERROR); 184 logging::LOG_ERROR, "GpuProcessHostUIShim",
185 dict->SetString("header", "GpuProcessHostUIShim"); 185 "GPU Process Crashed.");
186 dict->SetString("message", "GPU Process Crashed.");
187 GpuDataManagerImpl::GetInstance()->AddLogMessage(dict);
188 } 186 }
189 187
190 bool GpuProcessHostUIShim::OnControlMessageReceived( 188 bool GpuProcessHostUIShim::OnControlMessageReceived(
191 const IPC::Message& message) { 189 const IPC::Message& message) {
192 DCHECK(CalledOnValidThread()); 190 DCHECK(CalledOnValidThread());
193 191
194 IPC_BEGIN_MESSAGE_MAP(GpuProcessHostUIShim, message) 192 IPC_BEGIN_MESSAGE_MAP(GpuProcessHostUIShim, message)
195 IPC_MESSAGE_HANDLER(GpuHostMsg_OnLogMessage, 193 IPC_MESSAGE_HANDLER(GpuHostMsg_OnLogMessage,
196 OnLogMessage) 194 OnLogMessage)
197 195
(...skipping 18 matching lines...) Expand all
216 IPC_MESSAGE_UNHANDLED_ERROR() 214 IPC_MESSAGE_UNHANDLED_ERROR()
217 IPC_END_MESSAGE_MAP() 215 IPC_END_MESSAGE_MAP()
218 216
219 return true; 217 return true;
220 } 218 }
221 219
222 void GpuProcessHostUIShim::OnLogMessage( 220 void GpuProcessHostUIShim::OnLogMessage(
223 int level, 221 int level,
224 const std::string& header, 222 const std::string& header,
225 const std::string& message) { 223 const std::string& message) {
226 DictionaryValue* dict = new DictionaryValue(); 224 GpuDataManagerImpl::GetInstance()->AddLogMessage(
227 dict->SetInteger("level", level); 225 level, header, message);
228 dict->SetString("header", header);
229 dict->SetString("message", message);
230 GpuDataManagerImpl::GetInstance()->AddLogMessage(dict);
231 } 226 }
232 227
233 void GpuProcessHostUIShim::OnGraphicsInfoCollected( 228 void GpuProcessHostUIShim::OnGraphicsInfoCollected(
234 const content::GPUInfo& gpu_info) { 229 const content::GPUInfo& gpu_info) {
235 // OnGraphicsInfoCollected is sent back after the GPU process successfully 230 // OnGraphicsInfoCollected is sent back after the GPU process successfully
236 // initializes GL. 231 // initializes GL.
237 TRACE_EVENT0("test_gpu", "OnGraphicsInfoCollected"); 232 TRACE_EVENT0("test_gpu", "OnGraphicsInfoCollected");
238 233
239 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info); 234 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info);
240 } 235 }
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 return; 363 return;
369 view->AcceleratedSurfaceRelease(params.identifier); 364 view->AcceleratedSurfaceRelease(params.identifier);
370 } 365 }
371 366
372 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( 367 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived(
373 const content::GPUVideoMemoryUsageStats& video_memory_usage_stats) { 368 const content::GPUVideoMemoryUsageStats& video_memory_usage_stats) {
374 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( 369 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats(
375 video_memory_usage_stats); 370 video_memory_usage_stats);
376 } 371 }
377 372
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698