OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_SHELL_SHELL_H_ | 5 #ifndef SKY_SHELL_SHELL_H_ |
6 #define SKY_SHELL_SHELL_H_ | 6 #define SKY_SHELL_SHELL_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/message_loop/message_loop.h" |
11 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
| 13 #include "sky/shell/service_provider.h" |
12 | 14 |
13 namespace sky { | 15 namespace sky { |
14 namespace shell { | 16 namespace shell { |
15 class Engine; | |
16 class PlatformView; | |
17 class Rasterizer; | |
18 class ServiceProviderContext; | 17 class ServiceProviderContext; |
19 | 18 |
20 class Shell { | 19 class Shell { |
21 public: | 20 public: |
22 ~Shell(); | 21 ~Shell(); |
23 | 22 |
24 static void Init( | 23 static void Init( |
25 scoped_ptr<ServiceProviderContext> service_provider_context); | 24 scoped_ptr<ServiceProviderContext> service_provider_context); |
26 static Shell& Shared(); | 25 static Shell& Shared(); |
27 | 26 |
28 PlatformView* view() const { return view_.get(); } | 27 scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner() const { |
| 28 return gpu_thread_->message_loop()->task_runner(); |
| 29 } |
| 30 |
| 31 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner() const { |
| 32 return ui_thread_->message_loop()->task_runner(); |
| 33 } |
| 34 |
| 35 ServiceProviderContext* service_provider_context() const { |
| 36 return service_provider_context_.get(); |
| 37 } |
29 | 38 |
30 private: | 39 private: |
31 explicit Shell(scoped_ptr<ServiceProviderContext> service_provider_context); | 40 explicit Shell(scoped_ptr<ServiceProviderContext> service_provider_context); |
32 | 41 |
33 void InitGPU(const base::Thread::Options& options); | 42 void InitGPU(const base::Thread::Options& options); |
34 void InitUI(const base::Thread::Options& options); | 43 void InitUI(const base::Thread::Options& options); |
35 void InitView(); | |
36 | 44 |
37 scoped_ptr<base::Thread> gpu_thread_; | 45 scoped_ptr<base::Thread> gpu_thread_; |
38 scoped_ptr<base::Thread> ui_thread_; | 46 scoped_ptr<base::Thread> ui_thread_; |
39 | |
40 scoped_ptr<PlatformView> view_; | |
41 scoped_ptr<Rasterizer> rasterizer_; | |
42 scoped_ptr<Engine> engine_; | |
43 | |
44 scoped_ptr<ServiceProviderContext> service_provider_context_; | 47 scoped_ptr<ServiceProviderContext> service_provider_context_; |
45 | 48 |
46 DISALLOW_COPY_AND_ASSIGN(Shell); | 49 DISALLOW_COPY_AND_ASSIGN(Shell); |
47 }; | 50 }; |
48 | 51 |
49 } // namespace shell | 52 } // namespace shell |
50 } // namespace sky | 53 } // namespace sky |
51 | 54 |
52 #endif // SKY_SHELL_SHELL_H_ | 55 #endif // SKY_SHELL_SHELL_H_ |
OLD | NEW |