| 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 #ifndef MOJO_SERVICES_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_ | 5 #ifndef MOJO_SERVICES_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_ |
| 6 #define MOJO_SERVICES_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_ | 6 #define MOJO_SERVICES_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/threading/thread_local_storage.h" | 10 #include "base/threading/thread_local_storage.h" |
| 11 #include "base/timer/timer.h" | 11 #include "base/timer/timer.h" |
| 12 #include "cc/blink/web_compositor_support_impl.h" | 12 #include "cc/blink/web_compositor_support_impl.h" |
| 13 #include "mojo/services/html_viewer/blink_resource_map.h" | 13 #include "mojo/services/html_viewer/blink_resource_map.h" |
| 14 #include "mojo/services/html_viewer/webmimeregistry_impl.h" | 14 #include "mojo/services/html_viewer/webmimeregistry_impl.h" |
| 15 #include "mojo/services/html_viewer/webnotificationmanager_impl.h" |
| 15 #include "mojo/services/html_viewer/webscheduler_impl.h" | 16 #include "mojo/services/html_viewer/webscheduler_impl.h" |
| 16 #include "mojo/services/html_viewer/webthemeengine_impl.h" | 17 #include "mojo/services/html_viewer/webthemeengine_impl.h" |
| 17 #include "third_party/WebKit/public/platform/Platform.h" | 18 #include "third_party/WebKit/public/platform/Platform.h" |
| 18 #include "third_party/WebKit/public/platform/WebScrollbarBehavior.h" | 19 #include "third_party/WebKit/public/platform/WebScrollbarBehavior.h" |
| 19 | 20 |
| 20 namespace html_viewer { | 21 namespace html_viewer { |
| 21 | 22 |
| 22 class BlinkPlatformImpl : public blink::Platform { | 23 class BlinkPlatformImpl : public blink::Platform { |
| 23 public: | 24 public: |
| 24 explicit BlinkPlatformImpl(); | 25 explicit BlinkPlatformImpl(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 54 blink::WebWaitableEvent* waitMultipleEvents( | 55 blink::WebWaitableEvent* waitMultipleEvents( |
| 55 const blink::WebVector<blink::WebWaitableEvent*>& events) override; | 56 const blink::WebVector<blink::WebWaitableEvent*>& events) override; |
| 56 blink::WebScrollbarBehavior* scrollbarBehavior() override; | 57 blink::WebScrollbarBehavior* scrollbarBehavior() override; |
| 57 const unsigned char* getTraceCategoryEnabledFlag( | 58 const unsigned char* getTraceCategoryEnabledFlag( |
| 58 const char* category_name) override; | 59 const char* category_name) override; |
| 59 blink::WebData loadResource(const char* name) override; | 60 blink::WebData loadResource(const char* name) override; |
| 60 blink::WebGestureCurve* createFlingAnimationCurve( | 61 blink::WebGestureCurve* createFlingAnimationCurve( |
| 61 blink::WebGestureDevice device_source, | 62 blink::WebGestureDevice device_source, |
| 62 const blink::WebFloatPoint& velocity, | 63 const blink::WebFloatPoint& velocity, |
| 63 const blink::WebSize& cumulative_scroll) override; | 64 const blink::WebSize& cumulative_scroll) override; |
| 65 blink::WebNotificationManager* notificationManager() override; |
| 64 | 66 |
| 65 private: | 67 private: |
| 66 void SuspendSharedTimer(); | 68 void SuspendSharedTimer(); |
| 67 void ResumeSharedTimer(); | 69 void ResumeSharedTimer(); |
| 68 | 70 |
| 69 void DoTimeout() { | 71 void DoTimeout() { |
| 70 if (shared_timer_func_ && !shared_timer_suspended_) | 72 if (shared_timer_func_ && !shared_timer_suspended_) |
| 71 shared_timer_func_(); | 73 shared_timer_func_(); |
| 72 } | 74 } |
| 73 | 75 |
| 74 static void DestroyCurrentThread(void*); | 76 static void DestroyCurrentThread(void*); |
| 75 | 77 |
| 76 base::MessageLoop* main_loop_; | 78 base::MessageLoop* main_loop_; |
| 77 base::OneShotTimer<BlinkPlatformImpl> shared_timer_; | 79 base::OneShotTimer<BlinkPlatformImpl> shared_timer_; |
| 78 void (*shared_timer_func_)(); | 80 void (*shared_timer_func_)(); |
| 79 double shared_timer_fire_time_; | 81 double shared_timer_fire_time_; |
| 80 bool shared_timer_fire_time_was_set_while_suspended_; | 82 bool shared_timer_fire_time_was_set_while_suspended_; |
| 81 int shared_timer_suspended_; // counter | 83 int shared_timer_suspended_; // counter |
| 82 base::ThreadLocalStorage::Slot current_thread_slot_; | 84 base::ThreadLocalStorage::Slot current_thread_slot_; |
| 83 cc_blink::WebCompositorSupportImpl compositor_support_; | 85 cc_blink::WebCompositorSupportImpl compositor_support_; |
| 84 WebThemeEngineImpl theme_engine_; | 86 WebThemeEngineImpl theme_engine_; |
| 85 WebMimeRegistryImpl mime_registry_; | 87 WebMimeRegistryImpl mime_registry_; |
| 86 WebSchedulerImpl scheduler_; | 88 WebSchedulerImpl scheduler_; |
| 89 WebNotificationManagerImpl web_notification_manager_; |
| 87 blink::WebScrollbarBehavior scrollbar_behavior_; | 90 blink::WebScrollbarBehavior scrollbar_behavior_; |
| 88 BlinkResourceMap blink_resource_map_; | 91 BlinkResourceMap blink_resource_map_; |
| 89 | 92 |
| 90 DISALLOW_COPY_AND_ASSIGN(BlinkPlatformImpl); | 93 DISALLOW_COPY_AND_ASSIGN(BlinkPlatformImpl); |
| 91 }; | 94 }; |
| 92 | 95 |
| 93 } // namespace html_viewer | 96 } // namespace html_viewer |
| 94 | 97 |
| 95 #endif // MOJO_SERVICES_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_ | 98 #endif // MOJO_SERVICES_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_ |
| OLD | NEW |