Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(735)

Side by Side Diff: components/html_viewer/blink_platform_impl.h

Issue 1112573003: Hook up the scheduler component to html_viewer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 COMPONENTS_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_ 5 #ifndef COMPONENTS_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_
6 #define COMPONENTS_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_ 6 #define COMPONENTS_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 "components/html_viewer/blink_resource_map.h" 13 #include "components/html_viewer/blink_resource_map.h"
14 #include "components/html_viewer/mock_web_blob_registry_impl.h" 14 #include "components/html_viewer/mock_web_blob_registry_impl.h"
15 #include "components/html_viewer/web_mime_registry_impl.h" 15 #include "components/html_viewer/web_mime_registry_impl.h"
16 #include "components/html_viewer/web_notification_manager_impl.h" 16 #include "components/html_viewer/web_notification_manager_impl.h"
17 #include "components/html_viewer/web_scheduler_impl.h"
18 #include "components/html_viewer/web_theme_engine_impl.h" 17 #include "components/html_viewer/web_theme_engine_impl.h"
19 #include "components/webcrypto/webcrypto_impl.h" 18 #include "components/webcrypto/webcrypto_impl.h"
20 #include "mojo/services/network/public/interfaces/network_service.mojom.h" 19 #include "mojo/services/network/public/interfaces/network_service.mojom.h"
21 #include "third_party/WebKit/public/platform/Platform.h" 20 #include "third_party/WebKit/public/platform/Platform.h"
22 #include "third_party/WebKit/public/platform/WebScrollbarBehavior.h" 21 #include "third_party/WebKit/public/platform/WebScrollbarBehavior.h"
23 22
23 namespace scheduler {
24 class RendererScheduler;
25 class WebThreadImplForRendererScheduler;
26 }
27
24 namespace mojo { 28 namespace mojo {
25 class ApplicationImpl; 29 class ApplicationImpl;
26 } 30 }
27 31
28 namespace html_viewer { 32 namespace html_viewer {
29 33
30 class WebClipboardImpl; 34 class WebClipboardImpl;
31 class WebCookieJarImpl; 35 class WebCookieJarImpl;
32 36
33 class BlinkPlatformImpl : public blink::Platform { 37 class BlinkPlatformImpl : public blink::Platform {
34 public: 38 public:
35 // |app| may be null in tests. 39 // |app| may be null in tests.
36 explicit BlinkPlatformImpl(mojo::ApplicationImpl* app); 40 BlinkPlatformImpl(mojo::ApplicationImpl* app,
41 scheduler::RendererScheduler* renderer_scheduler);
37 virtual ~BlinkPlatformImpl(); 42 virtual ~BlinkPlatformImpl();
38 43
39 // blink::Platform methods: 44 // blink::Platform methods:
40 virtual blink::WebCookieJar* cookieJar(); 45 virtual blink::WebCookieJar* cookieJar();
41 virtual blink::WebClipboard* clipboard(); 46 virtual blink::WebClipboard* clipboard();
42 virtual blink::WebMimeRegistry* mimeRegistry(); 47 virtual blink::WebMimeRegistry* mimeRegistry();
43 virtual blink::WebThemeEngine* themeEngine(); 48 virtual blink::WebThemeEngine* themeEngine();
44 virtual blink::WebScheduler* scheduler();
45 virtual blink::WebString defaultLocale(); 49 virtual blink::WebString defaultLocale();
46 virtual blink::WebBlobRegistry* blobRegistry(); 50 virtual blink::WebBlobRegistry* blobRegistry();
47 virtual double currentTime(); 51 virtual double currentTime();
48 virtual double monotonicallyIncreasingTime(); 52 virtual double monotonicallyIncreasingTime();
49 virtual void cryptographicallyRandomValues(unsigned char* buffer, 53 virtual void cryptographicallyRandomValues(unsigned char* buffer,
50 size_t length); 54 size_t length);
51 virtual void setSharedTimerFiredFunction(void (*func)()); 55 virtual void setSharedTimerFiredFunction(void (*func)());
52 virtual void setSharedTimerFireInterval(double interval_seconds); 56 virtual void setSharedTimerFireInterval(double interval_seconds);
53 virtual void stopSharedTimer(); 57 virtual void stopSharedTimer();
54 virtual void callOnMainThread(void (*func)(void*), void* context); 58 virtual void callOnMainThread(void (*func)(void*), void* context);
(...skipping 22 matching lines...) Expand all
77 virtual blink::WebGestureCurve* createFlingAnimationCurve( 81 virtual blink::WebGestureCurve* createFlingAnimationCurve(
78 blink::WebGestureDevice device_source, 82 blink::WebGestureDevice device_source,
79 const blink::WebFloatPoint& velocity, 83 const blink::WebFloatPoint& velocity,
80 const blink::WebSize& cumulative_scroll); 84 const blink::WebSize& cumulative_scroll);
81 virtual blink::WebCrypto* crypto(); 85 virtual blink::WebCrypto* crypto();
82 virtual blink::WebNotificationManager* notificationManager(); 86 virtual blink::WebNotificationManager* notificationManager();
83 87
84 private: 88 private:
85 void SuspendSharedTimer(); 89 void SuspendSharedTimer();
86 void ResumeSharedTimer(); 90 void ResumeSharedTimer();
91 void UpdateWebThreadTLS(blink::WebThread* thread);
87 92
88 void DoTimeout() { 93 void DoTimeout() {
89 if (shared_timer_func_ && !shared_timer_suspended_) 94 if (shared_timer_func_ && !shared_timer_suspended_)
90 shared_timer_func_(); 95 shared_timer_func_();
91 } 96 }
92 97
93 static void DestroyCurrentThread(void*); 98 static void DestroyCurrentThread(void*);
94 99
95 base::MessageLoop* main_loop_; 100 scoped_refptr<base::SingleThreadTaskRunner> MainTaskRunnerForCurrentThread();
101
102 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
103 scoped_ptr<scheduler::WebThreadImplForRendererScheduler> main_thread_;
96 base::OneShotTimer<BlinkPlatformImpl> shared_timer_; 104 base::OneShotTimer<BlinkPlatformImpl> shared_timer_;
97 void (*shared_timer_func_)(); 105 void (*shared_timer_func_)();
98 double shared_timer_fire_time_; 106 double shared_timer_fire_time_;
99 bool shared_timer_fire_time_was_set_while_suspended_; 107 bool shared_timer_fire_time_was_set_while_suspended_;
100 int shared_timer_suspended_; // counter 108 int shared_timer_suspended_; // counter
101 base::ThreadLocalStorage::Slot current_thread_slot_; 109 base::ThreadLocalStorage::Slot current_thread_slot_;
102 cc_blink::WebCompositorSupportImpl compositor_support_; 110 cc_blink::WebCompositorSupportImpl compositor_support_;
103 WebThemeEngineImpl theme_engine_; 111 WebThemeEngineImpl theme_engine_;
104 WebMimeRegistryImpl mime_registry_; 112 WebMimeRegistryImpl mime_registry_;
105 WebSchedulerImpl scheduler_;
106 webcrypto::WebCryptoImpl web_crypto_; 113 webcrypto::WebCryptoImpl web_crypto_;
107 WebNotificationManagerImpl web_notification_manager_; 114 WebNotificationManagerImpl web_notification_manager_;
108 blink::WebScrollbarBehavior scrollbar_behavior_; 115 blink::WebScrollbarBehavior scrollbar_behavior_;
109 BlinkResourceMap blink_resource_map_; 116 BlinkResourceMap blink_resource_map_;
110 mojo::NetworkServicePtr network_service_; 117 mojo::NetworkServicePtr network_service_;
111 MockWebBlobRegistryImpl blob_registry_; 118 MockWebBlobRegistryImpl blob_registry_;
112 scoped_ptr<WebCookieJarImpl> cookie_jar_; 119 scoped_ptr<WebCookieJarImpl> cookie_jar_;
113 scoped_ptr<WebClipboardImpl> clipboard_; 120 scoped_ptr<WebClipboardImpl> clipboard_;
114 121
115 DISALLOW_COPY_AND_ASSIGN(BlinkPlatformImpl); 122 DISALLOW_COPY_AND_ASSIGN(BlinkPlatformImpl);
116 }; 123 };
117 124
118 } // namespace html_viewer 125 } // namespace html_viewer
119 126
120 #endif // COMPONENTS_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_ 127 #endif // COMPONENTS_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698