| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/child/webkitplatformsupport_child_impl.h" | 5 #include "content/child/webkitplatformsupport_child_impl.h" |
| 6 | 6 |
| 7 #include "base/memory/discardable_memory.h" | 7 #include "base/memory/discardable_memory.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
| 10 #include "content/child/web_discardable_memory_impl.h" | 10 #include "content/child/web_discardable_memory_impl.h" |
| 11 #include "content/child/worker_task_runner.h" |
| 11 #include "third_party/WebKit/public/platform/WebWaitableEvent.h" | 12 #include "third_party/WebKit/public/platform/WebWaitableEvent.h" |
| 12 #include "third_party/WebKit/public/web/WebInputEvent.h" | 13 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 13 #include "webkit/child/fling_curve_configuration.h" | 14 #include "webkit/child/fling_curve_configuration.h" |
| 14 #include "webkit/child/webthread_impl.h" | 15 #include "webkit/child/webthread_impl.h" |
| 15 #include "webkit/child/worker_task_runner.h" | |
| 16 | 16 |
| 17 #if defined(OS_ANDROID) | 17 #if defined(OS_ANDROID) |
| 18 #include "webkit/child/fling_animator_impl_android.h" | 18 #include "webkit/child/fling_animator_impl_android.h" |
| 19 #endif | 19 #endif |
| 20 | 20 |
| 21 using blink::WebFallbackThemeEngine; | 21 using blink::WebFallbackThemeEngine; |
| 22 using blink::WebThemeEngine; | 22 using blink::WebThemeEngine; |
| 23 | 23 |
| 24 namespace content { | 24 namespace content { |
| 25 | 25 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 base::WaitableEvent** events = new base::WaitableEvent*[web_events.size()]; | 113 base::WaitableEvent** events = new base::WaitableEvent*[web_events.size()]; |
| 114 for (size_t i = 0; i < web_events.size(); ++i) | 114 for (size_t i = 0; i < web_events.size(); ++i) |
| 115 events[i] = static_cast<WebWaitableEventImpl*>(web_events[i])->impl(); | 115 events[i] = static_cast<WebWaitableEventImpl*>(web_events[i])->impl(); |
| 116 size_t idx = base::WaitableEvent::WaitMany(events, web_events.size()); | 116 size_t idx = base::WaitableEvent::WaitMany(events, web_events.size()); |
| 117 DCHECK_LT(idx, web_events.size()); | 117 DCHECK_LT(idx, web_events.size()); |
| 118 return web_events[idx]; | 118 return web_events[idx]; |
| 119 } | 119 } |
| 120 | 120 |
| 121 void WebKitPlatformSupportChildImpl::didStartWorkerRunLoop( | 121 void WebKitPlatformSupportChildImpl::didStartWorkerRunLoop( |
| 122 const blink::WebWorkerRunLoop& runLoop) { | 122 const blink::WebWorkerRunLoop& runLoop) { |
| 123 webkit_glue::WorkerTaskRunner* worker_task_runner = | 123 WorkerTaskRunner* worker_task_runner = WorkerTaskRunner::Instance(); |
| 124 webkit_glue::WorkerTaskRunner::Instance(); | |
| 125 worker_task_runner->OnWorkerRunLoopStarted(runLoop); | 124 worker_task_runner->OnWorkerRunLoopStarted(runLoop); |
| 126 } | 125 } |
| 127 | 126 |
| 128 void WebKitPlatformSupportChildImpl::didStopWorkerRunLoop( | 127 void WebKitPlatformSupportChildImpl::didStopWorkerRunLoop( |
| 129 const blink::WebWorkerRunLoop& runLoop) { | 128 const blink::WebWorkerRunLoop& runLoop) { |
| 130 webkit_glue::WorkerTaskRunner* worker_task_runner = | 129 WorkerTaskRunner* worker_task_runner = WorkerTaskRunner::Instance(); |
| 131 webkit_glue::WorkerTaskRunner::Instance(); | |
| 132 worker_task_runner->OnWorkerRunLoopStopped(runLoop); | 130 worker_task_runner->OnWorkerRunLoopStopped(runLoop); |
| 133 } | 131 } |
| 134 | 132 |
| 135 blink::WebDiscardableMemory* | 133 blink::WebDiscardableMemory* |
| 136 WebKitPlatformSupportChildImpl::allocateAndLockDiscardableMemory(size_t bytes) { | 134 WebKitPlatformSupportChildImpl::allocateAndLockDiscardableMemory(size_t bytes) { |
| 137 base::DiscardableMemoryType type = | 135 base::DiscardableMemoryType type = |
| 138 base::DiscardableMemory::GetPreferredType(); | 136 base::DiscardableMemory::GetPreferredType(); |
| 139 if (type == base::DISCARDABLE_MEMORY_TYPE_EMULATED) | 137 if (type == base::DISCARDABLE_MEMORY_TYPE_EMULATED) |
| 140 return NULL; | 138 return NULL; |
| 141 return content::WebDiscardableMemoryImpl::CreateLockedMemory(bytes).release(); | 139 return content::WebDiscardableMemoryImpl::CreateLockedMemory(bytes).release(); |
| 142 } | 140 } |
| 143 | 141 |
| 144 // static | 142 // static |
| 145 void WebKitPlatformSupportChildImpl::DestroyCurrentThread(void* thread) { | 143 void WebKitPlatformSupportChildImpl::DestroyCurrentThread(void* thread) { |
| 146 webkit_glue::WebThreadImplForMessageLoop* impl = | 144 webkit_glue::WebThreadImplForMessageLoop* impl = |
| 147 static_cast<webkit_glue::WebThreadImplForMessageLoop*>(thread); | 145 static_cast<webkit_glue::WebThreadImplForMessageLoop*>(thread); |
| 148 delete impl; | 146 delete impl; |
| 149 } | 147 } |
| 150 | 148 |
| 151 } // namespace content | 149 } // namespace content |
| OLD | NEW |