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 #include "sky/shell/shell.h" | 5 #include "sky/shell/shell.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
10 #include "sky/shell/gpu/rasterizer.h" | |
10 #include "sky/shell/sky_view.h" | 11 #include "sky/shell/sky_view.h" |
12 #include "sky/shell/ui/engine.h" | |
11 | 13 |
12 namespace sky { | 14 namespace sky { |
13 namespace shell { | 15 namespace shell { |
14 | 16 |
15 Shell::Shell(scoped_refptr<base::SingleThreadTaskRunner> java_task_runner) | 17 Shell::Shell(scoped_refptr<base::SingleThreadTaskRunner> java_task_runner) |
16 : java_task_runner_(java_task_runner) { | 18 : java_task_runner_(java_task_runner) { |
17 } | 19 } |
18 | 20 |
19 Shell::~Shell() { | 21 Shell::~Shell() { |
20 } | 22 } |
21 | 23 |
22 void Shell::Init() { | 24 void Shell::Init() { |
23 gpu_thread_.reset(new base::Thread("gpu_thread")); | 25 gpu_thread_.reset(new base::Thread("gpu_thread")); |
24 gpu_thread_->Start(); | 26 gpu_thread_->Start(); |
25 rasterizer_.reset(new Rasterizer()); | 27 rasterizer_.reset(new Rasterizer()); |
26 | 28 |
27 ui_thread_.reset(new base::Thread("ui_thread")); | 29 ui_thread_.reset(new base::Thread("ui_thread")); |
28 ui_thread_->Start(); | 30 ui_thread_->Start(); |
29 engine_.reset(new Engine()); | 31 engine_.reset(new Engine()); |
30 | 32 |
31 ui_thread_->message_loop()->PostTask( | 33 ui_thread_->message_loop()->PostTask( |
32 FROM_HERE, base::Bind(&Engine::Init, engine_->GetWeakPtr())); | 34 FROM_HERE, base::Bind(&Engine::Init, engine_->GetWeakPtr())); |
33 | 35 |
34 view_.reset(new SkyView(this)); | 36 SkyView::Config config; |
35 view_->Init(); | 37 config.gpu_task_runner = gpu_thread_->message_loop()->task_runner(); |
eseidel
2015/02/05 05:57:28
Feels a little odd to not just ask the gpu_delegat
abarth-chromium
2015/02/05 06:16:23
Yeah, I just didn't want to talk to the gpu_delega
| |
36 } | 38 config.gpu_delegate = rasterizer_->GetWeakPtr(); |
39 config.ui_task_runner = ui_thread_->message_loop()->task_runner(); | |
40 config.ui_delegate = engine_->GetWeakPtr(); | |
37 | 41 |
38 void Shell::OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) { | 42 view_.reset(new SkyView(config)); |
39 gpu_thread_->message_loop()->PostTask( | |
40 FROM_HERE, | |
41 base::Bind(&Rasterizer::Init, rasterizer_->GetWeakPtr(), widget)); | |
42 } | |
43 | |
44 void Shell::OnDestroyed() { | |
45 } | 43 } |
46 | 44 |
47 } // namespace shell | 45 } // namespace shell |
48 } // namespace sky | 46 } // namespace sky |
OLD | NEW |