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

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

Issue 860073002: [ozone] Install ozone message filter in the gpu process in GpuChildThread() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 | « 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/threading/worker_pool.h" 9 #include "base/threading/worker_pool.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 26 matching lines...) Expand all
37 const std::string& str) { 37 const std::string& str) {
38 std::string header = str.substr(0, message_start); 38 std::string header = str.substr(0, message_start);
39 std::string message = str.substr(message_start); 39 std::string message = str.substr(message_start);
40 40
41 g_thread_safe_sender.Get()->Send(new GpuHostMsg_OnLogMessage( 41 g_thread_safe_sender.Get()->Send(new GpuHostMsg_OnLogMessage(
42 severity, header, message)); 42 severity, header, message));
43 43
44 return false; 44 return false;
45 } 45 }
46 46
47 ChildThread::Options GetOptions() {
48 ChildThread::Options options;
49
50 #if defined(USE_OZONE)
51 IPC::MessageFilter* message_filter = ui::OzonePlatform::GetInstance()
52 ->GetGpuPlatformSupport()
53 ->GetMessageFilter();
54 if (message_filter)
55 options.startup_filters.push_back(message_filter);
56 #endif
57
58 return options;
59 }
60
47 } // namespace 61 } // namespace
48 62
49 GpuChildThread::GpuChildThread(GpuWatchdogThread* watchdog_thread, 63 GpuChildThread::GpuChildThread(GpuWatchdogThread* watchdog_thread,
50 bool dead_on_arrival, 64 bool dead_on_arrival,
51 const gpu::GPUInfo& gpu_info, 65 const gpu::GPUInfo& gpu_info,
52 const DeferredMessages& deferred_messages) 66 const DeferredMessages& deferred_messages)
53 : dead_on_arrival_(dead_on_arrival), 67 : ChildThread(GetOptions()),
68 dead_on_arrival_(dead_on_arrival),
54 gpu_info_(gpu_info), 69 gpu_info_(gpu_info),
55 deferred_messages_(deferred_messages), 70 deferred_messages_(deferred_messages),
56 in_browser_process_(false) { 71 in_browser_process_(false) {
57 watchdog_thread_ = watchdog_thread; 72 watchdog_thread_ = watchdog_thread;
58 #if defined(OS_WIN) 73 #if defined(OS_WIN)
59 target_services_ = NULL; 74 target_services_ = NULL;
60 #endif 75 #endif
61 g_thread_safe_sender.Get() = thread_safe_sender(); 76 g_thread_safe_sender.Get() = thread_safe_sender();
62 } 77 }
63 78
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // IPC messages before the sandbox has been enabled and all other necessary 178 // IPC messages before the sandbox has been enabled and all other necessary
164 // initialization has succeeded. 179 // initialization has succeeded.
165 gpu_channel_manager_.reset( 180 gpu_channel_manager_.reset(
166 new GpuChannelManager(GetRouter(), 181 new GpuChannelManager(GetRouter(),
167 watchdog_thread_.get(), 182 watchdog_thread_.get(),
168 ChildProcess::current()->io_message_loop_proxy(), 183 ChildProcess::current()->io_message_loop_proxy(),
169 ChildProcess::current()->GetShutDownEvent(), 184 ChildProcess::current()->GetShutDownEvent(),
170 channel())); 185 channel()));
171 186
172 #if defined(USE_OZONE) 187 #if defined(USE_OZONE)
173 ui::GpuPlatformSupport* gpu_platform_support = 188 ui::OzonePlatform::GetInstance()
174 ui::OzonePlatform::GetInstance()->GetGpuPlatformSupport(); 189 ->GetGpuPlatformSupport()
175 190 ->OnChannelEstablished(this);
176 gpu_platform_support->OnChannelEstablished(this);
177 IPC::MessageFilter* message_filter = gpu_platform_support->GetMessageFilter();
178 if (message_filter)
179 channel()->AddFilter(message_filter);
180 #endif 191 #endif
181 } 192 }
182 193
183 void GpuChildThread::StopWatchdog() { 194 void GpuChildThread::StopWatchdog() {
184 if (watchdog_thread_.get()) { 195 if (watchdog_thread_.get()) {
185 watchdog_thread_->Stop(); 196 watchdog_thread_->Stop();
186 } 197 }
187 } 198 }
188 199
189 void GpuChildThread::OnCollectGraphicsInfo() { 200 void GpuChildThread::OnCollectGraphicsInfo() {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 } 284 }
274 285
275 void GpuChildThread::OnGpuSwitched() { 286 void GpuChildThread::OnGpuSwitched() {
276 DVLOG(1) << "GPU: GPU has switched"; 287 DVLOG(1) << "GPU: GPU has switched";
277 // Notify observers in the GPU process. 288 // Notify observers in the GPU process.
278 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched(); 289 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched();
279 } 290 }
280 291
281 } // namespace content 292 } // namespace content
282 293
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