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 "mojo/common/message_pump_mojo.h" | 9 #include "mojo/common/message_pump_mojo.h" |
10 #include "mojo/edk/embedder/embedder.h" | 10 #include "mojo/edk/embedder/embedder.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 base::Thread::Options options; | 32 base::Thread::Options options; |
33 options.message_pump_factory = base::Bind(&CreateMessagePumpMojo); | 33 options.message_pump_factory = base::Bind(&CreateMessagePumpMojo); |
34 | 34 |
35 gpu_thread_.reset(new base::Thread("gpu_thread")); | 35 gpu_thread_.reset(new base::Thread("gpu_thread")); |
36 gpu_thread_->StartWithOptions(options); | 36 gpu_thread_->StartWithOptions(options); |
37 | 37 |
38 ui_thread_.reset(new base::Thread("ui_thread")); | 38 ui_thread_.reset(new base::Thread("ui_thread")); |
39 ui_thread_->StartWithOptions(options); | 39 ui_thread_->StartWithOptions(options); |
40 | 40 |
41 ui_task_runner()->PostTask( | 41 ui_task_runner()->PostTask(FROM_HERE, base::Bind(&Engine::Init)); |
42 FROM_HERE, base::Bind(&Engine::Init, service_provider_context_.get())); | |
43 } | 42 } |
44 | 43 |
45 Shell::~Shell() { | 44 Shell::~Shell() { |
46 } | 45 } |
47 | 46 |
48 void Shell::Init(scoped_ptr<ServiceProviderContext> service_provider_context) { | 47 void Shell::Init(scoped_ptr<ServiceProviderContext> service_provider_context) { |
49 g_shell = new Shell(service_provider_context.Pass()); | 48 g_shell = new Shell(service_provider_context.Pass()); |
50 } | 49 } |
51 | 50 |
52 Shell& Shell::Shared() { | 51 Shell& Shell::Shared() { |
53 DCHECK(g_shell); | 52 DCHECK(g_shell); |
54 return *g_shell; | 53 return *g_shell; |
55 } | 54 } |
56 | 55 |
57 } // namespace shell | 56 } // namespace shell |
58 } // namespace sky | 57 } // namespace sky |
OLD | NEW |