OLD | NEW |
---|---|
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/renderer/renderer_blink_platform_impl.h" | 5 #include "content/renderer/renderer_blink_platform_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
221 // here. | 221 // here. |
222 base::Lock unicode_font_families_mutex_; | 222 base::Lock unicode_font_families_mutex_; |
223 std::map<int32_t, blink::WebFallbackFont> unicode_font_families_; | 223 std::map<int32_t, blink::WebFallbackFont> unicode_font_families_; |
224 #endif | 224 #endif |
225 }; | 225 }; |
226 #endif // defined(OS_ANDROID) | 226 #endif // defined(OS_ANDROID) |
227 | 227 |
228 //------------------------------------------------------------------------------ | 228 //------------------------------------------------------------------------------ |
229 | 229 |
230 RendererBlinkPlatformImpl::RendererBlinkPlatformImpl( | 230 RendererBlinkPlatformImpl::RendererBlinkPlatformImpl( |
231 RendererScheduler* renderer_scheduler) | 231 RendererScheduler* renderer_scheduler, |
232 : web_scheduler_(new WebSchedulerImpl(renderer_scheduler)), | 232 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner) |
233 : BlinkPlatformImpl(main_thread_task_runner), | |
rmcilroy
2014/11/06 22:31:20
Could we only have a renderer_scheduler as an argu
Sami
2014/11/06 22:39:35
Oh yeah, good idea.
alex clarke (OOO till 29th)
2014/11/06 22:54:37
Done.
alex clarke (OOO till 29th)
2014/11/06 22:54:37
Acknowledged.
| |
234 web_scheduler_(new WebSchedulerImpl(renderer_scheduler)), | |
233 clipboard_client_(new RendererClipboardClient), | 235 clipboard_client_(new RendererClipboardClient), |
234 clipboard_(new WebClipboardImpl(clipboard_client_.get())), | 236 clipboard_(new WebClipboardImpl(clipboard_client_.get())), |
235 mime_registry_(new RendererBlinkPlatformImpl::MimeRegistry), | 237 mime_registry_(new RendererBlinkPlatformImpl::MimeRegistry), |
236 sudden_termination_disables_(0), | 238 sudden_termination_disables_(0), |
237 plugin_refresh_allowed_(true), | 239 plugin_refresh_allowed_(true), |
238 default_task_runner_(renderer_scheduler->DefaultTaskRunner()), | 240 default_task_runner_(renderer_scheduler->DefaultTaskRunner()), |
239 child_thread_loop_(base::MessageLoopProxy::current()), | 241 child_thread_loop_(base::MessageLoopProxy::current()), |
240 web_scrollbar_behavior_(new WebScrollbarBehaviorImpl), | 242 web_scrollbar_behavior_(new WebScrollbarBehaviorImpl), |
241 bluetooth_(new WebBluetoothImpl) { | 243 bluetooth_(new WebBluetoothImpl) { |
242 if (g_sandbox_enabled && sandboxEnabled()) { | 244 if (g_sandbox_enabled && sandboxEnabled()) { |
243 sandbox_support_.reset(new RendererBlinkPlatformImpl::SandboxSupport); | 245 sandbox_support_.reset(new RendererBlinkPlatformImpl::SandboxSupport); |
244 } else { | 246 } else { |
245 DVLOG(1) << "Disabling sandbox support for testing."; | 247 DVLOG(1) << "Disabling sandbox support for testing."; |
246 } | 248 } |
247 | 249 |
248 // ChildThread may not exist in some tests. | 250 // ChildThread may not exist in some tests. |
249 if (ChildThread::current()) { | 251 if (ChildThread::current()) { |
250 sync_message_filter_ = ChildThread::current()->sync_message_filter(); | 252 sync_message_filter_ = ChildThread::current()->sync_message_filter(); |
251 thread_safe_sender_ = ChildThread::current()->thread_safe_sender(); | 253 thread_safe_sender_ = ChildThread::current()->thread_safe_sender(); |
252 quota_message_filter_ = ChildThread::current()->quota_message_filter(); | 254 quota_message_filter_ = ChildThread::current()->quota_message_filter(); |
253 blob_registry_.reset(new WebBlobRegistryImpl(thread_safe_sender_.get())); | 255 blob_registry_.reset(new WebBlobRegistryImpl(thread_safe_sender_.get())); |
254 web_idb_factory_.reset(new WebIDBFactoryImpl(thread_safe_sender_.get())); | 256 web_idb_factory_.reset(new WebIDBFactoryImpl(thread_safe_sender_.get())); |
255 web_database_observer_impl_.reset( | 257 web_database_observer_impl_.reset( |
256 new WebDatabaseObserverImpl(sync_message_filter_.get())); | 258 new WebDatabaseObserverImpl(sync_message_filter_.get())); |
257 } | 259 } |
260 | |
261 shared_timer_.SetTaskRunner(main_thread_task_runner_); | |
Sami
2014/11/06 22:20:44
Couldn't we do this in the base class since we're
alex clarke (OOO till 29th)
2014/11/06 22:28:34
Done.
| |
258 } | 262 } |
259 | 263 |
260 RendererBlinkPlatformImpl::~RendererBlinkPlatformImpl() { | 264 RendererBlinkPlatformImpl::~RendererBlinkPlatformImpl() { |
261 WebFileSystemImpl::DeleteThreadSpecificInstance(); | 265 WebFileSystemImpl::DeleteThreadSpecificInstance(); |
262 } | 266 } |
263 | 267 |
264 //------------------------------------------------------------------------------ | 268 //------------------------------------------------------------------------------ |
265 | 269 |
266 void RendererBlinkPlatformImpl::callOnMainThread(void (*func)(void*), | |
267 void* context) { | |
268 default_task_runner_->PostTask(FROM_HERE, base::Bind(func, context)); | |
269 } | |
270 | |
271 blink::WebScheduler* RendererBlinkPlatformImpl::scheduler() { | 270 blink::WebScheduler* RendererBlinkPlatformImpl::scheduler() { |
272 return web_scheduler_.get(); | 271 return web_scheduler_.get(); |
273 } | 272 } |
274 | 273 |
275 blink::WebClipboard* RendererBlinkPlatformImpl::clipboard() { | 274 blink::WebClipboard* RendererBlinkPlatformImpl::clipboard() { |
276 blink::WebClipboard* clipboard = | 275 blink::WebClipboard* clipboard = |
277 GetContentClient()->renderer()->OverrideWebClipboard(); | 276 GetContentClient()->renderer()->OverrideWebClipboard(); |
278 if (clipboard) | 277 if (clipboard) |
279 return clipboard; | 278 return clipboard; |
280 return clipboard_.get(); | 279 return clipboard_.get(); |
(...skipping 943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1224 //------------------------------------------------------------------------------ | 1223 //------------------------------------------------------------------------------ |
1225 | 1224 |
1226 void RendererBlinkPlatformImpl::MockBatteryStatusChangedForTesting( | 1225 void RendererBlinkPlatformImpl::MockBatteryStatusChangedForTesting( |
1227 const blink::WebBatteryStatus& status) { | 1226 const blink::WebBatteryStatus& status) { |
1228 if (!g_test_battery_status_listener) | 1227 if (!g_test_battery_status_listener) |
1229 return; | 1228 return; |
1230 g_test_battery_status_listener->updateBatteryStatus(status); | 1229 g_test_battery_status_listener->updateBatteryStatus(status); |
1231 } | 1230 } |
1232 | 1231 |
1233 } // namespace content | 1232 } // namespace content |
OLD | NEW |