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

Side by Side Diff: content/child/blink_platform_impl.h

Issue 1449953002: compositor-worker: Refactor CompositorWorkerManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clarify compositor thread ownership. guarantee initialization correctness. Created 5 years 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 CONTENT_CHILD_BLINK_PLATFORM_IMPL_H_ 5 #ifndef CONTENT_CHILD_BLINK_PLATFORM_IMPL_H_
6 #define CONTENT_CHILD_BLINK_PLATFORM_IMPL_H_ 6 #define CONTENT_CHILD_BLINK_PLATFORM_IMPL_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/containers/scoped_ptr_hash_map.h" 9 #include "base/containers/scoped_ptr_hash_map.h"
10 #include "base/threading/thread_local_storage.h" 10 #include "base/threading/thread_local_storage.h"
(...skipping 14 matching lines...) Expand all
25 #elif defined(OS_MACOSX) 25 #elif defined(OS_MACOSX)
26 #include "content/child/webthemeengine_impl_mac.h" 26 #include "content/child/webthemeengine_impl_mac.h"
27 #elif defined(OS_ANDROID) 27 #elif defined(OS_ANDROID)
28 #include "content/child/webthemeengine_impl_android.h" 28 #include "content/child/webthemeengine_impl_android.h"
29 #endif 29 #endif
30 30
31 namespace base { 31 namespace base {
32 class MessageLoop; 32 class MessageLoop;
33 } 33 }
34 34
35 namespace scheduler {
36 class WebThreadBase;
37 }
38
35 namespace content { 39 namespace content {
36 class BackgroundSyncProvider; 40 class BackgroundSyncProvider;
37 class FlingCurveConfiguration; 41 class FlingCurveConfiguration;
38 class NotificationDispatcher; 42 class NotificationDispatcher;
39 class PermissionDispatcher; 43 class PermissionDispatcher;
40 class PushDispatcher; 44 class PushDispatcher;
41 class ThreadSafeSender; 45 class ThreadSafeSender;
42 class WebCryptoImpl; 46 class WebCryptoImpl;
43 class WebGeofencingProviderImpl; 47 class WebGeofencingProviderImpl;
44 class WebMemoryDumpProviderAdapter; 48 class WebMemoryDumpProviderAdapter;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 blink::WebString queryLocalizedString( 164 blink::WebString queryLocalizedString(
161 blink::WebLocalizedString::Name name, 165 blink::WebLocalizedString::Name name,
162 const blink::WebString& value1, 166 const blink::WebString& value1,
163 const blink::WebString& value2) override; 167 const blink::WebString& value2) override;
164 void suddenTerminationChanged(bool enabled) override {} 168 void suddenTerminationChanged(bool enabled) override {}
165 double currentTimeSeconds() override; 169 double currentTimeSeconds() override;
166 double monotonicallyIncreasingTimeSeconds() override; 170 double monotonicallyIncreasingTimeSeconds() override;
167 double systemTraceTime() override; 171 double systemTraceTime() override;
168 void cryptographicallyRandomValues(unsigned char* buffer, 172 void cryptographicallyRandomValues(unsigned char* buffer,
169 size_t length) override; 173 size_t length) override;
174 blink::WebThread* compositorThread() const override;
170 blink::WebGestureCurve* createFlingAnimationCurve( 175 blink::WebGestureCurve* createFlingAnimationCurve(
171 blink::WebGestureDevice device_source, 176 blink::WebGestureDevice device_source,
172 const blink::WebFloatPoint& velocity, 177 const blink::WebFloatPoint& velocity,
173 const blink::WebSize& cumulative_scroll) override; 178 const blink::WebSize& cumulative_scroll) override;
174 void didStartWorkerRunLoop() override; 179 void didStartWorkerRunLoop() override;
175 void didStopWorkerRunLoop() override; 180 void didStopWorkerRunLoop() override;
176 blink::WebCrypto* crypto() override; 181 blink::WebCrypto* crypto() override;
177 blink::WebGeofencingProvider* geofencingProvider() override; 182 blink::WebGeofencingProvider* geofencingProvider() override;
178 blink::WebNotificationManager* notificationManager() override; 183 blink::WebNotificationManager* notificationManager() override;
179 blink::WebPushProvider* pushProvider() override; 184 blink::WebPushProvider* pushProvider() override;
180 blink::WebServicePortProvider* createServicePortProvider( 185 blink::WebServicePortProvider* createServicePortProvider(
181 blink::WebServicePortProviderClient*) override; 186 blink::WebServicePortProviderClient*) override;
182 blink::WebPermissionClient* permissionClient() override; 187 blink::WebPermissionClient* permissionClient() override;
183 blink::WebSyncProvider* backgroundSyncProvider() override; 188 blink::WebSyncProvider* backgroundSyncProvider() override;
184 189
185 blink::WebString domCodeStringFromEnum(int dom_code) override; 190 blink::WebString domCodeStringFromEnum(int dom_code) override;
186 int domEnumFromCodeString(const blink::WebString& codeString) override; 191 int domEnumFromCodeString(const blink::WebString& codeString) override;
187 blink::WebString domKeyStringFromEnum(int dom_key) override; 192 blink::WebString domKeyStringFromEnum(int dom_key) override;
188 int domKeyEnumFromString(const blink::WebString& key_string) override; 193 int domKeyEnumFromString(const blink::WebString& key_string) override;
189 194
195 blink::WebThread* createThreadWithOptions(const char* name,
piman 2015/12/01 23:44:41 nit: can you have this return a scoped_ptr<WebThre
Ian Vollick 2015/12/02 00:26:40 Done.
196 base::Thread::Options);
197
198 // This class does *not* own |compositor_thread|. It is the responsibility of
199 // the caller to ensure that the compositor thread is cleared before it is
200 // destructed.
201 void set_compositor_thread(scheduler::WebThreadBase* compositor_thread) {
202 compositor_thread_ = compositor_thread;
203 }
204
190 private: 205 private:
191 void InternalInit(); 206 void InternalInit();
192 void UpdateWebThreadTLS(blink::WebThread* thread); 207 void UpdateWebThreadTLS(blink::WebThread* thread);
193 208
194 bool IsMainThread() const; 209 bool IsMainThread() const;
195 210
196 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; 211 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
197 WebThemeEngineImpl native_theme_engine_; 212 WebThemeEngineImpl native_theme_engine_;
198 WebFallbackThemeEngineImpl fallback_theme_engine_; 213 WebFallbackThemeEngineImpl fallback_theme_engine_;
199 base::ThreadLocalStorage::Slot current_thread_slot_; 214 base::ThreadLocalStorage::Slot current_thread_slot_;
200 webcrypto::WebCryptoImpl web_crypto_; 215 webcrypto::WebCryptoImpl web_crypto_;
201 scoped_ptr<WebGeofencingProviderImpl> geofencing_provider_; 216 scoped_ptr<WebGeofencingProviderImpl> geofencing_provider_;
202 base::ScopedPtrHashMap<blink::WebMemoryDumpProvider*, 217 base::ScopedPtrHashMap<blink::WebMemoryDumpProvider*,
203 scoped_ptr<WebMemoryDumpProviderAdapter>> 218 scoped_ptr<WebMemoryDumpProviderAdapter>>
204 memory_dump_providers_; 219 memory_dump_providers_;
205 220
206 scoped_refptr<ThreadSafeSender> thread_safe_sender_; 221 scoped_refptr<ThreadSafeSender> thread_safe_sender_;
207 scoped_refptr<NotificationDispatcher> notification_dispatcher_; 222 scoped_refptr<NotificationDispatcher> notification_dispatcher_;
208 scoped_refptr<PushDispatcher> push_dispatcher_; 223 scoped_refptr<PushDispatcher> push_dispatcher_;
209 scoped_ptr<PermissionDispatcher> permission_client_; 224 scoped_ptr<PermissionDispatcher> permission_client_;
210 scoped_ptr<BackgroundSyncProvider> main_thread_sync_provider_; 225 scoped_ptr<BackgroundSyncProvider> main_thread_sync_provider_;
226
227 scheduler::WebThreadBase* compositor_thread_;
211 }; 228 };
212 229
213 } // namespace content 230 } // namespace content
214 231
215 #endif // CONTENT_CHILD_BLINK_PLATFORM_IMPL_H_ 232 #endif // CONTENT_CHILD_BLINK_PLATFORM_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698