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

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

Issue 897563002: Unify the three places that patch font loading for PDFium on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
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() { 47 ChildThreadImpl::Options GetOptions() {
48 ChildThread::Options options; 48 ChildThreadImpl::Options options;
49 49
50 #if defined(USE_OZONE) 50 #if defined(USE_OZONE)
51 IPC::MessageFilter* message_filter = ui::OzonePlatform::GetInstance() 51 IPC::MessageFilter* message_filter = ui::OzonePlatform::GetInstance()
52 ->GetGpuPlatformSupport() 52 ->GetGpuPlatformSupport()
53 ->GetMessageFilter(); 53 ->GetMessageFilter();
54 if (message_filter) 54 if (message_filter)
55 options.startup_filters.push_back(message_filter); 55 options.startup_filters.push_back(message_filter);
56 #endif 56 #endif
57 57
58 return options; 58 return options;
59 } 59 }
60 60
61 } // namespace 61 } // namespace
62 62
63 GpuChildThread::GpuChildThread(GpuWatchdogThread* watchdog_thread, 63 GpuChildThread::GpuChildThread(GpuWatchdogThread* watchdog_thread,
64 bool dead_on_arrival, 64 bool dead_on_arrival,
65 const gpu::GPUInfo& gpu_info, 65 const gpu::GPUInfo& gpu_info,
66 const DeferredMessages& deferred_messages) 66 const DeferredMessages& deferred_messages)
67 : ChildThread(GetOptions()), 67 : ChildThreadImpl(GetOptions()),
68 dead_on_arrival_(dead_on_arrival), 68 dead_on_arrival_(dead_on_arrival),
69 gpu_info_(gpu_info), 69 gpu_info_(gpu_info),
70 deferred_messages_(deferred_messages), 70 deferred_messages_(deferred_messages),
71 in_browser_process_(false) { 71 in_browser_process_(false) {
72 watchdog_thread_ = watchdog_thread; 72 watchdog_thread_ = watchdog_thread;
73 #if defined(OS_WIN) 73 #if defined(OS_WIN)
74 target_services_ = NULL; 74 target_services_ = NULL;
75 #endif 75 #endif
76 g_thread_safe_sender.Get() = thread_safe_sender(); 76 g_thread_safe_sender.Get() = thread_safe_sender();
77 } 77 }
78 78
79 GpuChildThread::GpuChildThread(const std::string& channel_id) 79 GpuChildThread::GpuChildThread(const std::string& channel_id)
80 : ChildThread(Options(channel_id, false)), 80 : ChildThreadImpl(Options(channel_id, false)),
81 dead_on_arrival_(false), 81 dead_on_arrival_(false),
82 in_browser_process_(true) { 82 in_browser_process_(true) {
83 #if defined(OS_WIN) 83 #if defined(OS_WIN)
84 target_services_ = NULL; 84 target_services_ = NULL;
85 #endif 85 #endif
86 DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( 86 DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
87 switches::kSingleProcess) || 87 switches::kSingleProcess) ||
88 base::CommandLine::ForCurrentProcess()->HasSwitch( 88 base::CommandLine::ForCurrentProcess()->HasSwitch(
89 switches::kInProcessGPU)); 89 switches::kInProcessGPU));
90 #if !defined(OS_ANDROID) 90 #if !defined(OS_ANDROID)
91 // For single process and in-process GPU mode, we need to load and 91 // For single process and in-process GPU mode, we need to load and
92 // initialize the GL implementation and locate the GL entry points here. 92 // initialize the GL implementation and locate the GL entry points here.
93 // On Android, GLSurface::InitializeOneOff() is called from BrowserMainLoop 93 // On Android, GLSurface::InitializeOneOff() is called from BrowserMainLoop
94 // before getting here. crbug.com/326295 94 // before getting here. crbug.com/326295
95 if (!gfx::GLSurface::InitializeOneOff()) 95 if (!gfx::GLSurface::InitializeOneOff())
96 VLOG(1) << "gfx::GLSurface::InitializeOneOff failed"; 96 VLOG(1) << "gfx::GLSurface::InitializeOneOff failed";
97 #endif 97 #endif
98 g_thread_safe_sender.Get() = thread_safe_sender(); 98 g_thread_safe_sender.Get() = thread_safe_sender();
99 } 99 }
100 100
101 GpuChildThread::~GpuChildThread() { 101 GpuChildThread::~GpuChildThread() {
102 } 102 }
103 103
104 void GpuChildThread::Shutdown() { 104 void GpuChildThread::Shutdown() {
105 ChildThread::Shutdown(); 105 ChildThreadImpl::Shutdown();
106 logging::SetLogMessageHandler(NULL); 106 logging::SetLogMessageHandler(NULL);
107 } 107 }
108 108
109 void GpuChildThread::Init(const base::Time& process_start_time) { 109 void GpuChildThread::Init(const base::Time& process_start_time) {
110 process_start_time_ = process_start_time; 110 process_start_time_ = process_start_time;
111 } 111 }
112 112
113 bool GpuChildThread::Send(IPC::Message* msg) { 113 bool GpuChildThread::Send(IPC::Message* msg) {
114 // The GPU process must never send a synchronous IPC message to the browser 114 // The GPU process must never send a synchronous IPC message to the browser
115 // process. This could result in deadlock. 115 // process. This could result in deadlock.
116 DCHECK(!msg->is_sync()); 116 DCHECK(!msg->is_sync());
117 117
118 return ChildThread::Send(msg); 118 return ChildThreadImpl::Send(msg);
119 } 119 }
120 120
121 bool GpuChildThread::OnControlMessageReceived(const IPC::Message& msg) { 121 bool GpuChildThread::OnControlMessageReceived(const IPC::Message& msg) {
122 bool handled = true; 122 bool handled = true;
123 IPC_BEGIN_MESSAGE_MAP(GpuChildThread, msg) 123 IPC_BEGIN_MESSAGE_MAP(GpuChildThread, msg)
124 IPC_MESSAGE_HANDLER(GpuMsg_Initialize, OnInitialize) 124 IPC_MESSAGE_HANDLER(GpuMsg_Initialize, OnInitialize)
125 IPC_MESSAGE_HANDLER(GpuMsg_CollectGraphicsInfo, OnCollectGraphicsInfo) 125 IPC_MESSAGE_HANDLER(GpuMsg_CollectGraphicsInfo, OnCollectGraphicsInfo)
126 IPC_MESSAGE_HANDLER(GpuMsg_GetVideoMemoryUsageStats, 126 IPC_MESSAGE_HANDLER(GpuMsg_GetVideoMemoryUsageStats,
127 OnGetVideoMemoryUsageStats) 127 OnGetVideoMemoryUsageStats)
128 IPC_MESSAGE_HANDLER(GpuMsg_Clean, OnClean) 128 IPC_MESSAGE_HANDLER(GpuMsg_Clean, OnClean)
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 } 284 }
285 285
286 void GpuChildThread::OnGpuSwitched() { 286 void GpuChildThread::OnGpuSwitched() {
287 DVLOG(1) << "GPU: GPU has switched"; 287 DVLOG(1) << "GPU: GPU has switched";
288 // Notify observers in the GPU process. 288 // Notify observers in the GPU process.
289 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched(); 289 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched();
290 } 290 }
291 291
292 } // namespace content 292 } // namespace content
293 293
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698