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

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

Issue 1139873004: Make android directory for Android-specific bits of SkyShell (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 7 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"
11 #include "sky/engine/public/web/Sky.h" 11 #include "sky/engine/public/web/Sky.h"
12 #include "sky/engine/public/web/WebLocalFrame.h" 12 #include "sky/engine/public/web/WebLocalFrame.h"
13 #include "sky/engine/public/web/WebSettings.h" 13 #include "sky/engine/public/web/WebSettings.h"
14 #include "sky/engine/public/web/WebView.h" 14 #include "sky/engine/public/web/WebView.h"
15 #include "sky/services/platform/platform_impl.h" 15 #include "sky/services/platform/platform_impl.h"
16 #include "sky/shell/java_service_provider.h" 16 #include "sky/shell/service_provider.h"
17 #include "sky/shell/ui/animator.h" 17 #include "sky/shell/ui/animator.h"
18 #include "sky/shell/ui/input_event_converter.h" 18 #include "sky/shell/ui/input_event_converter.h"
19 #include "sky/shell/ui/internals.h" 19 #include "sky/shell/ui/internals.h"
20 #include "third_party/skia/include/core/SkCanvas.h" 20 #include "third_party/skia/include/core/SkCanvas.h"
21 #include "third_party/skia/include/core/SkPictureRecorder.h" 21 #include "third_party/skia/include/core/SkPictureRecorder.h"
22 22
23 namespace sky { 23 namespace sky {
24 namespace shell { 24 namespace shell {
25 25
26 namespace { 26 namespace {
(...skipping 17 matching lines...) Expand all
44 44
45 Engine::~Engine() { 45 Engine::~Engine() {
46 if (web_view_) 46 if (web_view_)
47 web_view_->close(); 47 web_view_->close();
48 } 48 }
49 49
50 base::WeakPtr<Engine> Engine::GetWeakPtr() { 50 base::WeakPtr<Engine> Engine::GetWeakPtr() {
51 return weak_factory_.GetWeakPtr(); 51 return weak_factory_.GetWeakPtr();
52 } 52 }
53 53
54 mojo::ServiceProviderPtr Engine::CreateServiceProvider() {
55 mojo::MessagePipe pipe;
56 config_.java_task_runner->PostTask(
57 FROM_HERE,
58 base::Bind(CreateJavaServiceProvider,
59 base::Passed(mojo::MakeRequest<mojo::ServiceProvider>(
60 pipe.handle1.Pass()))));
61 return mojo::MakeProxy(
62 mojo::InterfacePtrInfo<mojo::ServiceProvider>(pipe.handle0.Pass(), 0u));
63 }
64
65 void Engine::Init() { 54 void Engine::Init() {
66 TRACE_EVENT0("sky", "Engine::Init"); 55 TRACE_EVENT0("sky", "Engine::Init");
67 56
68 service_provider_ = CreateServiceProvider(); 57 service_provider_ = CreateServiceProvider(config_.service_provider_context);
69 mojo::NetworkServicePtr network_service; 58 mojo::NetworkServicePtr network_service;
70 mojo::ConnectToService(service_provider_.get(), &network_service); 59 mojo::ConnectToService(service_provider_.get(), &network_service);
71 platform_impl_.reset(new PlatformImpl(network_service.Pass())); 60 platform_impl_.reset(new PlatformImpl(network_service.Pass()));
72 61
73 blink::initialize(platform_impl_.get()); 62 blink::initialize(platform_impl_.get());
74 } 63 }
75 64
76 void Engine::BeginFrame(base::TimeTicks frame_time) { 65 void Engine::BeginFrame(base::TimeTicks frame_time) {
77 TRACE_EVENT0("sky", "Engine::BeginFrame"); 66 TRACE_EVENT0("sky", "Engine::BeginFrame");
78 67
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 160
172 void Engine::initializeLayerTreeView() { 161 void Engine::initializeLayerTreeView() {
173 } 162 }
174 163
175 void Engine::scheduleVisualUpdate() { 164 void Engine::scheduleVisualUpdate() {
176 animator_->RequestFrame(); 165 animator_->RequestFrame();
177 } 166 }
178 167
179 void Engine::didCreateIsolate(blink::WebLocalFrame* frame, 168 void Engine::didCreateIsolate(blink::WebLocalFrame* frame,
180 Dart_Isolate isolate) { 169 Dart_Isolate isolate) {
181 Internals::Create(isolate, CreateServiceProvider()); 170 Internals::Create(isolate,
171 CreateServiceProvider(config_.service_provider_context));
182 } 172 }
183 173
184 blink::ServiceProvider* Engine::services() { 174 blink::ServiceProvider* Engine::services() {
185 return this; 175 return this;
186 } 176 }
187 177
188 mojo::NavigatorHost* Engine::NavigatorHost() { 178 mojo::NavigatorHost* Engine::NavigatorHost() {
189 return this; 179 return this;
190 } 180 }
191 181
192 void Engine::RequestNavigate(mojo::Target target, 182 void Engine::RequestNavigate(mojo::Target target,
193 mojo::URLRequestPtr request) { 183 mojo::URLRequestPtr request) {
194 // Ignoring target for now. 184 // Ignoring target for now.
195 base::MessageLoop::current()->PostTask(FROM_HERE, 185 base::MessageLoop::current()->PostTask(FROM_HERE,
196 base::Bind(&Engine::LoadURL, GetWeakPtr(), request->url)); 186 base::Bind(&Engine::LoadURL, GetWeakPtr(), request->url));
197 } 187 }
198 188
199 void Engine::DidNavigateLocally(const mojo::String& url) { 189 void Engine::DidNavigateLocally(const mojo::String& url) {
200 } 190 }
201 191
202 void Engine::RequestNavigateHistory(int32_t delta) { 192 void Engine::RequestNavigateHistory(int32_t delta) {
203 NOTIMPLEMENTED(); 193 NOTIMPLEMENTED();
204 } 194 }
205 195
206 } // namespace shell 196 } // namespace shell
207 } // namespace sky 197 } // 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