| 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/sky_view.h" | 10 #include "sky/shell/sky_view.h" |
| 11 | 11 |
| 12 namespace sky { | 12 namespace sky { |
| 13 namespace shell { | 13 namespace shell { |
| 14 | 14 |
| 15 Shell::Shell(scoped_refptr<base::SingleThreadTaskRunner> java_task_runner) | 15 Shell::Shell(scoped_refptr<base::SingleThreadTaskRunner> java_task_runner) |
| 16 : java_task_runner_(java_task_runner) { | 16 : java_task_runner_(java_task_runner) { |
| 17 } | 17 } |
| 18 | 18 |
| 19 Shell::~Shell() { | 19 Shell::~Shell() { |
| 20 } | 20 } |
| 21 | 21 |
| 22 void Shell::Init() { | 22 void Shell::Init() { |
| 23 gpu_thread_.reset(new base::Thread("gpu_thread")); | 23 gpu_thread_.reset(new base::Thread("gpu_thread")); |
| 24 gpu_thread_->Start(); | 24 gpu_thread_->Start(); |
| 25 rasterizer_.reset(new Rasterizer()); | 25 rasterizer_.reset(new Rasterizer()); |
| 26 | 26 |
| 27 ui_thread_.reset(new base::Thread("ui_thread")); |
| 28 ui_thread_->Start(); |
| 29 engine_.reset(new Engine()); |
| 30 |
| 31 ui_thread_->message_loop()->PostTask( |
| 32 FROM_HERE, base::Bind(&Engine::Init, engine_->GetWeakPtr())); |
| 33 |
| 27 view_.reset(new SkyView(this)); | 34 view_.reset(new SkyView(this)); |
| 28 view_->Init(); | 35 view_->Init(); |
| 29 } | 36 } |
| 30 | 37 |
| 31 void Shell::OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) { | 38 void Shell::OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) { |
| 32 gpu_thread_->message_loop()->PostTask( | 39 gpu_thread_->message_loop()->PostTask( |
| 33 FROM_HERE, | 40 FROM_HERE, |
| 34 base::Bind(&Rasterizer::Init, rasterizer_->GetWeakPtr(), widget)); | 41 base::Bind(&Rasterizer::Init, rasterizer_->GetWeakPtr(), widget)); |
| 35 } | 42 } |
| 36 | 43 |
| 37 void Shell::OnDestroyed() { | 44 void Shell::OnDestroyed() { |
| 38 } | 45 } |
| 39 | 46 |
| 40 } // namespace shell | 47 } // namespace shell |
| 41 } // namespace sky | 48 } // namespace sky |
| OLD | NEW |