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

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

Issue 14335017: content: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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 | « content/common/webmessageportchannel_impl.cc ('k') | content/gpu/gpu_info_collector_win.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) 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"
(...skipping 20 matching lines...) Expand all
31 31
32 bool GpuProcessLogMessageHandler(int severity, 32 bool GpuProcessLogMessageHandler(int severity,
33 const char* file, int line, 33 const char* file, int line,
34 size_t message_start, 34 size_t message_start,
35 const std::string& str) { 35 const std::string& str) {
36 std::string header = str.substr(0, message_start); 36 std::string header = str.substr(0, message_start);
37 std::string message = str.substr(message_start); 37 std::string message = str.substr(message_start);
38 38
39 // If we are not on main thread in child process, send through 39 // If we are not on main thread in child process, send through
40 // the sync_message_filter; otherwise send directly. 40 // the sync_message_filter; otherwise send directly.
41 if (MessageLoop::current() != 41 if (base::MessageLoop::current() !=
42 ChildProcess::current()->main_thread()->message_loop()) { 42 ChildProcess::current()->main_thread()->message_loop()) {
43 ChildProcess::current()->main_thread()->sync_message_filter()->Send( 43 ChildProcess::current()->main_thread()->sync_message_filter()->Send(
44 new GpuHostMsg_OnLogMessage(severity, header, message)); 44 new GpuHostMsg_OnLogMessage(severity, header, message));
45 } else { 45 } else {
46 ChildThread::current()->Send(new GpuHostMsg_OnLogMessage(severity, header, 46 ChildThread::current()->Send(new GpuHostMsg_OnLogMessage(severity, header,
47 message)); 47 message));
48 } 48 }
49 49
50 return false; 50 return false;
51 } 51 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 120
121 return gpu_channel_manager_.get() && 121 return gpu_channel_manager_.get() &&
122 gpu_channel_manager_->OnMessageReceived(msg); 122 gpu_channel_manager_->OnMessageReceived(msg);
123 } 123 }
124 124
125 void GpuChildThread::OnInitialize() { 125 void GpuChildThread::OnInitialize() {
126 Send(new GpuHostMsg_Initialized(!dead_on_arrival_)); 126 Send(new GpuHostMsg_Initialized(!dead_on_arrival_));
127 127
128 if (dead_on_arrival_) { 128 if (dead_on_arrival_) {
129 VLOG(1) << "Exiting GPU process due to errors during initialization"; 129 VLOG(1) << "Exiting GPU process due to errors during initialization";
130 MessageLoop::current()->Quit(); 130 base::MessageLoop::current()->Quit();
131 return; 131 return;
132 } 132 }
133 133
134 #if defined(OS_ANDROID) 134 #if defined(OS_ANDROID)
135 // TODO(epenner): Move thread priorities to base. (crbug.com/170549) 135 // TODO(epenner): Move thread priorities to base. (crbug.com/170549)
136 int nice_value = -6; // High priority 136 int nice_value = -6; // High priority
137 setpriority(PRIO_PROCESS, base::PlatformThread::CurrentId(), nice_value); 137 setpriority(PRIO_PROCESS, base::PlatformThread::CurrentId(), nice_value);
138 #endif 138 #endif
139 139
140 // We don't need to pipe log messages if we are running the GPU thread in 140 // We don't need to pipe log messages if we are running the GPU thread in
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 // so it's OK to be blocking. 186 // so it's OK to be blocking.
187 gpu_info_collector::GetDxDiagnostics(&gpu_info_.dx_diagnostics); 187 gpu_info_collector::GetDxDiagnostics(&gpu_info_.dx_diagnostics);
188 gpu_info_.finalized = true; 188 gpu_info_.finalized = true;
189 #endif // OS_WIN 189 #endif // OS_WIN
190 190
191 Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info_)); 191 Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info_));
192 192
193 #if defined(OS_WIN) 193 #if defined(OS_WIN)
194 if (!in_browser_process_) { 194 if (!in_browser_process_) {
195 // The unsandboxed GPU process fulfilled its duty. Rest in peace. 195 // The unsandboxed GPU process fulfilled its duty. Rest in peace.
196 MessageLoop::current()->Quit(); 196 base::MessageLoop::current()->Quit();
197 } 197 }
198 #endif // OS_WIN 198 #endif // OS_WIN
199 } 199 }
200 200
201 void GpuChildThread::OnGetVideoMemoryUsageStats() { 201 void GpuChildThread::OnGetVideoMemoryUsageStats() {
202 GPUVideoMemoryUsageStats video_memory_usage_stats; 202 GPUVideoMemoryUsageStats video_memory_usage_stats;
203 if (gpu_channel_manager_) 203 if (gpu_channel_manager_)
204 gpu_channel_manager_->gpu_memory_manager()->GetVideoMemoryUsageStats( 204 gpu_channel_manager_->gpu_memory_manager()->GetVideoMemoryUsageStats(
205 &video_memory_usage_stats); 205 &video_memory_usage_stats);
206 Send(new GpuHostMsg_VideoMemoryUsageStats(video_memory_usage_stats)); 206 Send(new GpuHostMsg_VideoMemoryUsageStats(video_memory_usage_stats));
(...skipping 27 matching lines...) Expand all
234 // the future posting of tasks to the message loop. 234 // the future posting of tasks to the message loop.
235 if (watchdog_thread_->message_loop()) 235 if (watchdog_thread_->message_loop())
236 watchdog_thread_->PostAcknowledge(); 236 watchdog_thread_->PostAcknowledge();
237 // Prevent rearming. 237 // Prevent rearming.
238 watchdog_thread_->Stop(); 238 watchdog_thread_->Stop();
239 } 239 }
240 } 240 }
241 241
242 } // namespace content 242 } // namespace content
243 243
OLDNEW
« no previous file with comments | « content/common/webmessageportchannel_impl.cc ('k') | content/gpu/gpu_info_collector_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698