| 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 "components/html_viewer/blink_platform_impl.h" | 5 #include "components/html_viewer/blink_platform_impl.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
| 11 #include "base/stl_util.h" | |
| 12 #include "base/synchronization/waitable_event.h" | 11 #include "base/synchronization/waitable_event.h" |
| 13 #include "base/thread_task_runner_handle.h" | 12 #include "base/thread_task_runner_handle.h" |
| 14 #include "base/threading/platform_thread.h" | 13 #include "base/threading/platform_thread.h" |
| 15 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 16 #include "base/trace_event/trace_event.h" | 15 #include "base/trace_event/trace_event.h" |
| 17 #include "components/html_viewer/blink_resource_constants.h" | 16 #include "components/html_viewer/blink_resource_constants.h" |
| 18 #include "components/html_viewer/global_state.h" | 17 #include "components/html_viewer/global_state.h" |
| 19 #include "components/html_viewer/web_clipboard_impl.h" | 18 #include "components/html_viewer/web_clipboard_impl.h" |
| 20 #include "components/html_viewer/web_cookie_jar_impl.h" | 19 #include "components/html_viewer/web_cookie_jar_impl.h" |
| 21 #include "components/html_viewer/web_graphics_context_3d_command_buffer_impl.h" | 20 #include "components/html_viewer/web_graphics_context_3d_command_buffer_impl.h" |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 blink::WebWaitableEvent::ResetPolicy policy, | 282 blink::WebWaitableEvent::ResetPolicy policy, |
| 284 blink::WebWaitableEvent::InitialState state) { | 283 blink::WebWaitableEvent::InitialState state) { |
| 285 return new WebWaitableEventImpl(policy, state); | 284 return new WebWaitableEventImpl(policy, state); |
| 286 } | 285 } |
| 287 | 286 |
| 288 blink::WebWaitableEvent* BlinkPlatformImpl::waitMultipleEvents( | 287 blink::WebWaitableEvent* BlinkPlatformImpl::waitMultipleEvents( |
| 289 const blink::WebVector<blink::WebWaitableEvent*>& web_events) { | 288 const blink::WebVector<blink::WebWaitableEvent*>& web_events) { |
| 290 std::vector<base::WaitableEvent*> events; | 289 std::vector<base::WaitableEvent*> events; |
| 291 for (size_t i = 0; i < web_events.size(); ++i) | 290 for (size_t i = 0; i < web_events.size(); ++i) |
| 292 events.push_back(static_cast<WebWaitableEventImpl*>(web_events[i])->impl()); | 291 events.push_back(static_cast<WebWaitableEventImpl*>(web_events[i])->impl()); |
| 293 size_t idx = base::WaitableEvent::WaitMany( | 292 size_t idx = base::WaitableEvent::WaitMany(events.data(), events.size()); |
| 294 vector_as_array(&events), events.size()); | |
| 295 DCHECK_LT(idx, web_events.size()); | 293 DCHECK_LT(idx, web_events.size()); |
| 296 return web_events[idx]; | 294 return web_events[idx]; |
| 297 } | 295 } |
| 298 | 296 |
| 299 blink::WebGestureCurve* BlinkPlatformImpl::createFlingAnimationCurve( | 297 blink::WebGestureCurve* BlinkPlatformImpl::createFlingAnimationCurve( |
| 300 blink::WebGestureDevice device_source, | 298 blink::WebGestureDevice device_source, |
| 301 const blink::WebFloatPoint& velocity, | 299 const blink::WebFloatPoint& velocity, |
| 302 const blink::WebSize& cumulative_scroll) { | 300 const blink::WebSize& cumulative_scroll) { |
| 303 const bool is_main_thread = true; | 301 const bool is_main_thread = true; |
| 304 return ui::WebGestureCurveImpl::CreateFromDefaultPlatformCurve( | 302 return ui::WebGestureCurveImpl::CreateFromDefaultPlatformCurve( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 315 BlinkPlatformImpl::notificationManager() { | 313 BlinkPlatformImpl::notificationManager() { |
| 316 return &web_notification_manager_; | 314 return &web_notification_manager_; |
| 317 } | 315 } |
| 318 | 316 |
| 319 void BlinkPlatformImpl::UpdateWebThreadTLS(blink::WebThread* thread) { | 317 void BlinkPlatformImpl::UpdateWebThreadTLS(blink::WebThread* thread) { |
| 320 DCHECK(!current_thread_slot_.Get()); | 318 DCHECK(!current_thread_slot_.Get()); |
| 321 current_thread_slot_.Set(thread); | 319 current_thread_slot_.Set(thread); |
| 322 } | 320 } |
| 323 | 321 |
| 324 } // namespace html_viewer | 322 } // namespace html_viewer |
| OLD | NEW |