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

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

Issue 1187503003: Refactor SkyShell to allow multiple SkyViews (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: s/instance/sky_shell/ Created 5 years, 6 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/trace_event/trace_event.h" 8 #include "base/trace_event/trace_event.h"
9 #include "mojo/public/cpp/application/connect.h" 9 #include "mojo/public/cpp/application/connect.h"
10 #include "sky/engine/public/platform/WebInputEvent.h" 10 #include "sky/engine/public/platform/WebInputEvent.h"
(...skipping 15 matching lines...) Expand all
26 namespace shell { 26 namespace shell {
27 27
28 namespace { 28 namespace {
29 29
30 void ConfigureSettings(blink::WebSettings* settings) { 30 void ConfigureSettings(blink::WebSettings* settings) {
31 settings->setDefaultFixedFontSize(13); 31 settings->setDefaultFixedFontSize(13);
32 settings->setDefaultFontSize(16); 32 settings->setDefaultFontSize(16);
33 settings->setLoadsImagesAutomatically(true); 33 settings->setLoadsImagesAutomatically(true);
34 } 34 }
35 35
36 PlatformImpl* g_platform_impl = nullptr;
37
36 } 38 }
37 39
38 Engine::Engine(const Config& config) 40 Engine::Engine(const Config& config)
39 : config_(config), 41 : config_(config),
40 animator_(new Animator(config, this)), 42 animator_(new Animator(config, this)),
41 web_view_(nullptr), 43 web_view_(nullptr),
42 device_pixel_ratio_(1.0f), 44 device_pixel_ratio_(1.0f),
43 viewport_observer_binding_(this), 45 viewport_observer_binding_(this),
44 weak_factory_(this) { 46 weak_factory_(this) {
45 } 47 }
46 48
47 Engine::~Engine() { 49 Engine::~Engine() {
48 if (web_view_) 50 if (web_view_)
49 web_view_->close(); 51 web_view_->close();
50 } 52 }
51 53
52 base::WeakPtr<Engine> Engine::GetWeakPtr() { 54 base::WeakPtr<Engine> Engine::GetWeakPtr() {
53 return weak_factory_.GetWeakPtr(); 55 return weak_factory_.GetWeakPtr();
54 } 56 }
55 57
56 void Engine::Init() { 58 void Engine::Init(ServiceProviderContext* service_provider_context) {
57 TRACE_EVENT0("sky", "Engine::Init"); 59 TRACE_EVENT0("sky", "Engine::Init");
58 60
59 service_provider_ = CreateServiceProvider(config_.service_provider_context); 61 mojo::ServiceProviderPtr service_provider =
62 CreateServiceProvider(service_provider_context);
60 mojo::NetworkServicePtr network_service; 63 mojo::NetworkServicePtr network_service;
61 mojo::ConnectToService(service_provider_.get(), &network_service); 64 mojo::ConnectToService(service_provider.get(), &network_service);
62 platform_impl_.reset(new PlatformImpl(network_service.Pass()));
63 65
64 blink::initialize(platform_impl_.get()); 66 DCHECK(!g_platform_impl);
67 g_platform_impl = new PlatformImpl(network_service.Pass());
68 blink::initialize(g_platform_impl);
65 } 69 }
66 70
67 void Engine::BeginFrame(base::TimeTicks frame_time) { 71 void Engine::BeginFrame(base::TimeTicks frame_time) {
68 TRACE_EVENT0("sky", "Engine::BeginFrame"); 72 TRACE_EVENT0("sky", "Engine::BeginFrame");
69 73
70 if (sky_view_) 74 if (sky_view_)
71 sky_view_->BeginFrame(frame_time); 75 sky_view_->BeginFrame(frame_time);
72 76
73 if (web_view_) { 77 if (web_view_) {
74 double frame_time_sec = (frame_time - base::TimeTicks()).InSecondsF(); 78 double frame_time_sec = (frame_time - base::TimeTicks()).InSecondsF();
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 248
245 void Engine::DidNavigateLocally(const mojo::String& url) { 249 void Engine::DidNavigateLocally(const mojo::String& url) {
246 } 250 }
247 251
248 void Engine::RequestNavigateHistory(int32_t delta) { 252 void Engine::RequestNavigateHistory(int32_t delta) {
249 NOTIMPLEMENTED(); 253 NOTIMPLEMENTED();
250 } 254 }
251 255
252 } // namespace shell 256 } // namespace shell
253 } // namespace sky 257 } // 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