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

Side by Side Diff: content/gpu/gpu_child_thread.cc

Issue 9812022: Fix sending log messages from GPU child threads (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add braces Created 8 years, 9 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
« no previous file with comments | « no previous file | no next file » | 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/gpu/gpu_child_thread.h" 5 #include "content/gpu/gpu_child_thread.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/threading/worker_pool.h" 12 #include "base/threading/worker_pool.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 #include "content/common/child_process.h" 14 #include "content/common/child_process.h"
15 #include "content/common/gpu/gpu_messages.h" 15 #include "content/common/gpu/gpu_messages.h"
16 #include "content/public/common/content_switches.h" 16 #include "content/public/common/content_switches.h"
17 #include "content/gpu/gpu_info_collector.h" 17 #include "content/gpu/gpu_info_collector.h"
18 #include "content/gpu/gpu_watchdog_thread.h" 18 #include "content/gpu/gpu_watchdog_thread.h"
19 #include "ipc/ipc_channel_handle.h" 19 #include "ipc/ipc_channel_handle.h"
20 #include "ipc/ipc_sync_message_filter.h"
20 #include "ui/gfx/gl/gl_implementation.h" 21 #include "ui/gfx/gl/gl_implementation.h"
21 22
22 const int kGpuTimeout = 10000; 23 const int kGpuTimeout = 10000;
23 24
24 namespace { 25 namespace {
25 26
26 bool GpuProcessLogMessageHandler(int severity, 27 bool GpuProcessLogMessageHandler(int severity,
27 const char* file, int line, 28 const char* file, int line,
28 size_t message_start, 29 size_t message_start,
29 const std::string& str) { 30 const std::string& str) {
30 std::string header = str.substr(0, message_start); 31 std::string header = str.substr(0, message_start);
31 std::string message = str.substr(message_start); 32 std::string message = str.substr(message_start);
32 ChildThread::current()->Send( 33
33 new GpuHostMsg_OnLogMessage(severity, header, message)); 34 // If we are not on main thread in child process, send through
35 // the sync_message_filter; otherwise send directly.
36 if (MessageLoop::current() !=
37 ChildProcess::current()->main_thread()->message_loop()) {
38 ChildProcess::current()->main_thread()->sync_message_filter()->Send(
39 new GpuHostMsg_OnLogMessage(severity, header, message));
40 } else {
41 ChildThread::current()->Send(new GpuHostMsg_OnLogMessage(severity, header,
42 message));
43 }
44
34 return false; 45 return false;
35 } 46 }
36 47
37 } // namespace 48 } // namespace
38 49
39 GpuChildThread::GpuChildThread(bool dead_on_arrival, 50 GpuChildThread::GpuChildThread(bool dead_on_arrival,
40 const content::GPUInfo& gpu_info) 51 const content::GPUInfo& gpu_info)
41 : dead_on_arrival_(dead_on_arrival), 52 : dead_on_arrival_(dead_on_arrival),
42 gpu_info_(gpu_info) { 53 gpu_info_(gpu_info) {
43 #if defined(OS_WIN) 54 #if defined(OS_WIN)
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 // Runs on the main thread. 237 // Runs on the main thread.
227 void GpuChildThread::SetDxDiagnostics(GpuChildThread* thread, 238 void GpuChildThread::SetDxDiagnostics(GpuChildThread* thread,
228 const content::DxDiagNode& node) { 239 const content::DxDiagNode& node) {
229 thread->gpu_info_.dx_diagnostics = node; 240 thread->gpu_info_.dx_diagnostics = node;
230 thread->gpu_info_.finalized = true; 241 thread->gpu_info_.finalized = true;
231 thread->collecting_dx_diagnostics_ = false; 242 thread->collecting_dx_diagnostics_ = false;
232 thread->Send(new GpuHostMsg_GraphicsInfoCollected(thread->gpu_info_)); 243 thread->Send(new GpuHostMsg_GraphicsInfoCollected(thread->gpu_info_));
233 } 244 }
234 245
235 #endif 246 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698