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

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

Issue 959773005: Share sky::PlatformImpl bettween sky_viewer and SkyShell (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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') | sky/shell/ui/platform_impl.h » ('j') | 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 "mojo/public/cpp/application/connect.h"
8 #include "sky/engine/public/platform/WebInputEvent.h" 9 #include "sky/engine/public/platform/WebInputEvent.h"
9 #include "sky/engine/public/web/Sky.h" 10 #include "sky/engine/public/web/Sky.h"
10 #include "sky/engine/public/web/WebLocalFrame.h" 11 #include "sky/engine/public/web/WebLocalFrame.h"
11 #include "sky/engine/public/web/WebSettings.h" 12 #include "sky/engine/public/web/WebSettings.h"
12 #include "sky/engine/public/web/WebView.h" 13 #include "sky/engine/public/web/WebView.h"
14 #include "sky/services/platform/platform_impl.h"
13 #include "sky/shell/ui/animator.h" 15 #include "sky/shell/ui/animator.h"
14 #include "sky/shell/ui/input_event_converter.h" 16 #include "sky/shell/ui/input_event_converter.h"
15 #include "sky/shell/ui/platform_impl.h"
16 #include "third_party/skia/include/core/SkCanvas.h" 17 #include "third_party/skia/include/core/SkCanvas.h"
17 #include "third_party/skia/include/core/SkPictureRecorder.h" 18 #include "third_party/skia/include/core/SkPictureRecorder.h"
18 19
19 namespace sky { 20 namespace sky {
20 namespace shell { 21 namespace shell {
21 22
22 namespace { 23 namespace {
23 24
24 void ConfigureSettings(blink::WebSettings* settings) { 25 void ConfigureSettings(blink::WebSettings* settings) {
25 settings->setDefaultFixedFontSize(13); 26 settings->setDefaultFixedFontSize(13);
(...skipping 13 matching lines...) Expand all
39 40
40 Engine::~Engine() { 41 Engine::~Engine() {
41 if (web_view_) 42 if (web_view_)
42 web_view_->close(); 43 web_view_->close();
43 } 44 }
44 45
45 base::WeakPtr<Engine> Engine::GetWeakPtr() { 46 base::WeakPtr<Engine> Engine::GetWeakPtr() {
46 return weak_factory_.GetWeakPtr(); 47 return weak_factory_.GetWeakPtr();
47 } 48 }
48 49
49 void Engine::Init(mojo::ScopedMessagePipeHandle service_provider) { 50 void Engine::Init(mojo::ScopedMessagePipeHandle service_provider_handle) {
50 platform_impl_.reset(new PlatformImpl( 51 mojo::ServiceProviderPtr service_provider =
51 mojo::MakeProxy<mojo::ServiceProvider>(service_provider.Pass()))); 52 mojo::MakeProxy<mojo::ServiceProvider>(service_provider_handle.Pass());
53 mojo::NetworkServicePtr network_service;
54 mojo::ConnectToService(service_provider.get(), &network_service);
55 platform_impl_.reset(new PlatformImpl(network_service.Pass()));
56
52 blink::initialize(platform_impl_.get()); 57 blink::initialize(platform_impl_.get());
53 } 58 }
54 59
55 void Engine::BeginFrame(base::TimeTicks frame_time) { 60 void Engine::BeginFrame(base::TimeTicks frame_time) {
56 double frame_time_sec = (frame_time - base::TimeTicks()).InSecondsF(); 61 double frame_time_sec = (frame_time - base::TimeTicks()).InSecondsF();
57 double deadline_sec = frame_time_sec; 62 double deadline_sec = frame_time_sec;
58 double interval_sec = 1.0 / 60; 63 double interval_sec = 1.0 / 60;
59 blink::WebBeginFrameArgs args(frame_time_sec, deadline_sec, interval_sec); 64 blink::WebBeginFrameArgs args(frame_time_sec, deadline_sec, interval_sec);
60 65
61 web_view_->beginFrame(args); 66 web_view_->beginFrame(args);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 128
124 void Engine::initializeLayerTreeView() { 129 void Engine::initializeLayerTreeView() {
125 } 130 }
126 131
127 void Engine::scheduleVisualUpdate() { 132 void Engine::scheduleVisualUpdate() {
128 animator_->RequestFrame(); 133 animator_->RequestFrame();
129 } 134 }
130 135
131 } // namespace shell 136 } // namespace shell
132 } // namespace sky 137 } // namespace sky
OLDNEW
« no previous file with comments | « sky/shell/ui/engine.h ('k') | sky/shell/ui/platform_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698