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

Side by Side Diff: sky/shell/ui/engine.cc

Issue 1230113006: Remove last use of Platform::networkService() (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 months 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
« no previous file with comments | « sky/shell/ui/engine.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/ui/engine.h" 5 #include "sky/shell/ui/engine.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/threading/worker_pool.h" 9 #include "base/threading/worker_pool.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 Engine::Config::~Config() { 55 Engine::Config::~Config() {
56 } 56 }
57 57
58 Engine::Engine(const Config& config) 58 Engine::Engine(const Config& config)
59 : config_(config), 59 : config_(config),
60 animator_(new Animator(config, this)), 60 animator_(new Animator(config, this)),
61 binding_(this), 61 binding_(this),
62 activity_running_(false), 62 activity_running_(false),
63 have_surface_(false), 63 have_surface_(false),
64 weak_factory_(this) { 64 weak_factory_(this) {
65 mojo::ServiceProviderPtr service_provider =
66 CreateServiceProvider(config.service_provider_context);
67 mojo::ConnectToService(service_provider.get(), &network_service_);
65 } 68 }
66 69
67 Engine::~Engine() { 70 Engine::~Engine() {
68 } 71 }
69 72
70 base::WeakPtr<Engine> Engine::GetWeakPtr() { 73 base::WeakPtr<Engine> Engine::GetWeakPtr() {
71 return weak_factory_.GetWeakPtr(); 74 return weak_factory_.GetWeakPtr();
72 } 75 }
73 76
74 void Engine::Init(ServiceProviderContext* service_provider_context) { 77 void Engine::Init() {
75 TRACE_EVENT0("sky", "Engine::Init"); 78 TRACE_EVENT0("sky", "Engine::Init");
76 79
77 mojo::ServiceProviderPtr service_provider =
78 CreateServiceProvider(service_provider_context);
79 mojo::NetworkServicePtr network_service;
80 mojo::ConnectToService(service_provider.get(), &network_service);
81
82 DCHECK(!g_platform_impl); 80 DCHECK(!g_platform_impl);
83 g_platform_impl = new PlatformImpl(); 81 g_platform_impl = new PlatformImpl();
84 blink::initialize(g_platform_impl); 82 blink::initialize(g_platform_impl);
85 } 83 }
86 84
87 void Engine::BeginFrame(base::TimeTicks frame_time) { 85 void Engine::BeginFrame(base::TimeTicks frame_time) {
88 TRACE_EVENT0("sky", "Engine::BeginFrame"); 86 TRACE_EVENT0("sky", "Engine::BeginFrame");
89 87
90 if (sky_view_) 88 if (sky_view_)
91 sky_view_->BeginFrame(frame_time); 89 sky_view_->BeginFrame(frame_time);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 void Engine::RunFromSnapshotStream( 166 void Engine::RunFromSnapshotStream(
169 const std::string& name, 167 const std::string& name,
170 mojo::ScopedDataPipeConsumerHandle snapshot) { 168 mojo::ScopedDataPipeConsumerHandle snapshot) {
171 sky_view_ = blink::SkyView::Create(this); 169 sky_view_ = blink::SkyView::Create(this);
172 sky_view_->RunFromSnapshot(blink::WebString::fromUTF8(name), snapshot.Pass()); 170 sky_view_->RunFromSnapshot(blink::WebString::fromUTF8(name), snapshot.Pass());
173 sky_view_->SetDisplayMetrics(display_metrics_); 171 sky_view_->SetDisplayMetrics(display_metrics_);
174 } 172 }
175 173
176 void Engine::RunFromNetwork(const mojo::String& url) { 174 void Engine::RunFromNetwork(const mojo::String& url) {
177 dart_library_provider_.reset( 175 dart_library_provider_.reset(
178 new DartLibraryProviderNetwork(g_platform_impl->networkService())); 176 new DartLibraryProviderNetwork(network_service_.get()));
179 RunFromLibrary(url); 177 RunFromLibrary(url);
180 } 178 }
181 179
182 void Engine::RunFromFile(const mojo::String& main, 180 void Engine::RunFromFile(const mojo::String& main,
183 const mojo::String& package_root) { 181 const mojo::String& package_root) {
184 dart_library_provider_.reset( 182 dart_library_provider_.reset(
185 new DartLibraryProviderFiles(base::FilePath(package_root))); 183 new DartLibraryProviderFiles(base::FilePath(package_root)));
186 RunFromLibrary(main); 184 RunFromLibrary(main);
187 } 185 }
188 186
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 242
245 void Engine::DidNavigateLocally(const mojo::String& url) { 243 void Engine::DidNavigateLocally(const mojo::String& url) {
246 } 244 }
247 245
248 void Engine::RequestNavigateHistory(int32_t delta) { 246 void Engine::RequestNavigateHistory(int32_t delta) {
249 NOTIMPLEMENTED(); 247 NOTIMPLEMENTED();
250 } 248 }
251 249
252 } // namespace shell 250 } // namespace shell
253 } // namespace sky 251 } // namespace sky
OLDNEW
« no previous file with comments | « sky/shell/ui/engine.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698