| 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 SKY_ENGINE_TESTING_PLATFORM_PLATFORM_IMPL_H_ | 5 #ifndef SKY_ENGINE_TESTING_PLATFORM_PLATFORM_IMPL_H_ |
| 6 #define SKY_ENGINE_TESTING_PLATFORM_PLATFORM_IMPL_H_ | 6 #define SKY_ENGINE_TESTING_PLATFORM_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 "sky/engine/public/platform/Platform.h" | 12 #include "sky/engine/public/platform/Platform.h" |
| 13 #include "sky/engine/public/platform/WebScrollbarBehavior.h" | |
| 14 #include "sky/engine/testing/platform/webmimeregistry_impl.h" | 13 #include "sky/engine/testing/platform/webmimeregistry_impl.h" |
| 15 #include "sky/engine/testing/platform/webthemeengine_impl.h" | 14 #include "sky/engine/testing/platform/webthemeengine_impl.h" |
| 16 #include "sky/engine/testing/platform/webunittestsupport_impl.h" | 15 #include "sky/engine/testing/platform/webunittestsupport_impl.h" |
| 17 | 16 |
| 18 namespace sky { | 17 namespace sky { |
| 19 | 18 |
| 20 class PlatformImpl : public blink::Platform { | 19 class PlatformImpl : public blink::Platform { |
| 21 public: | 20 public: |
| 22 explicit PlatformImpl(); | 21 explicit PlatformImpl(); |
| 23 virtual ~PlatformImpl(); | 22 virtual ~PlatformImpl(); |
| 24 | 23 |
| 25 // blink::Platform methods: | 24 // blink::Platform methods: |
| 26 virtual blink::WebUnitTestSupport* unitTestSupport(); | 25 virtual blink::WebUnitTestSupport* unitTestSupport(); |
| 27 virtual blink::WebMimeRegistry* mimeRegistry(); | 26 virtual blink::WebMimeRegistry* mimeRegistry(); |
| 28 virtual blink::WebThemeEngine* themeEngine(); | 27 virtual blink::WebThemeEngine* themeEngine(); |
| 29 virtual blink::WebString defaultLocale(); | 28 virtual blink::WebString defaultLocale(); |
| 30 virtual double currentTime(); | 29 virtual double currentTime(); |
| 31 virtual double monotonicallyIncreasingTime(); | 30 virtual double monotonicallyIncreasingTime(); |
| 32 virtual void setSharedTimerFiredFunction(void (*func)()); | 31 virtual void setSharedTimerFiredFunction(void (*func)()); |
| 33 virtual void setSharedTimerFireInterval(double interval_seconds); | 32 virtual void setSharedTimerFireInterval(double interval_seconds); |
| 34 virtual void stopSharedTimer(); | 33 virtual void stopSharedTimer(); |
| 35 virtual blink::WebScrollbarBehavior* scrollbarBehavior(); | |
| 36 virtual const unsigned char* getTraceCategoryEnabledFlag( | 34 virtual const unsigned char* getTraceCategoryEnabledFlag( |
| 37 const char* category_name); | 35 const char* category_name); |
| 38 | 36 |
| 39 private: | 37 private: |
| 40 void SuspendSharedTimer(); | 38 void SuspendSharedTimer(); |
| 41 void ResumeSharedTimer(); | 39 void ResumeSharedTimer(); |
| 42 | 40 |
| 43 void DoTimeout() { | 41 void DoTimeout() { |
| 44 if (shared_timer_func_ && !shared_timer_suspended_) | 42 if (shared_timer_func_ && !shared_timer_suspended_) |
| 45 shared_timer_func_(); | 43 shared_timer_func_(); |
| 46 } | 44 } |
| 47 | 45 |
| 48 base::MessageLoop* main_loop_; | 46 base::MessageLoop* main_loop_; |
| 49 base::OneShotTimer<PlatformImpl> shared_timer_; | 47 base::OneShotTimer<PlatformImpl> shared_timer_; |
| 50 void (*shared_timer_func_)(); | 48 void (*shared_timer_func_)(); |
| 51 double shared_timer_fire_time_; | 49 double shared_timer_fire_time_; |
| 52 bool shared_timer_fire_time_was_set_while_suspended_; | 50 bool shared_timer_fire_time_was_set_while_suspended_; |
| 53 int shared_timer_suspended_; // counter | 51 int shared_timer_suspended_; // counter |
| 54 WebThemeEngineImpl theme_engine_; | 52 WebThemeEngineImpl theme_engine_; |
| 55 WebMimeRegistryImpl mime_registry_; | 53 WebMimeRegistryImpl mime_registry_; |
| 56 WebUnitTestSupportImpl unit_test_support_; | 54 WebUnitTestSupportImpl unit_test_support_; |
| 57 blink::WebScrollbarBehavior scrollbar_behavior_; | |
| 58 | 55 |
| 59 DISALLOW_COPY_AND_ASSIGN(PlatformImpl); | 56 DISALLOW_COPY_AND_ASSIGN(PlatformImpl); |
| 60 }; | 57 }; |
| 61 | 58 |
| 62 } // namespace sky | 59 } // namespace sky |
| 63 | 60 |
| 64 #endif // SKY_ENGINE_TESTING_PLATFORM_PLATFORM_IMPL_H_ | 61 #endif // SKY_ENGINE_TESTING_PLATFORM_PLATFORM_IMPL_H_ |
| OLD | NEW |