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

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

Issue 1027913002: Add more trace events to Sky (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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/gpu/rasterizer.cc ('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 "mojo/public/cpp/application/connect.h" 9 #include "mojo/public/cpp/application/connect.h"
9 #include "sky/engine/public/platform/WebInputEvent.h" 10 #include "sky/engine/public/platform/WebInputEvent.h"
10 #include "sky/engine/public/web/Sky.h" 11 #include "sky/engine/public/web/Sky.h"
11 #include "sky/engine/public/web/WebLocalFrame.h" 12 #include "sky/engine/public/web/WebLocalFrame.h"
12 #include "sky/engine/public/web/WebSettings.h" 13 #include "sky/engine/public/web/WebSettings.h"
13 #include "sky/engine/public/web/WebView.h" 14 #include "sky/engine/public/web/WebView.h"
14 #include "sky/services/platform/platform_impl.h" 15 #include "sky/services/platform/platform_impl.h"
15 #include "sky/shell/java_service_provider.h" 16 #include "sky/shell/java_service_provider.h"
16 #include "sky/shell/ui/animator.h" 17 #include "sky/shell/ui/animator.h"
17 #include "sky/shell/ui/input_event_converter.h" 18 #include "sky/shell/ui/input_event_converter.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 mojo::MessagePipe pipe; 55 mojo::MessagePipe pipe;
55 config_.java_task_runner->PostTask( 56 config_.java_task_runner->PostTask(
56 FROM_HERE, 57 FROM_HERE,
57 base::Bind(CreateJavaServiceProvider, 58 base::Bind(CreateJavaServiceProvider,
58 base::Passed(mojo::MakeRequest<mojo::ServiceProvider>( 59 base::Passed(mojo::MakeRequest<mojo::ServiceProvider>(
59 pipe.handle1.Pass())))); 60 pipe.handle1.Pass()))));
60 return mojo::MakeProxy<mojo::ServiceProvider>(pipe.handle0.Pass()); 61 return mojo::MakeProxy<mojo::ServiceProvider>(pipe.handle0.Pass());
61 } 62 }
62 63
63 void Engine::Init() { 64 void Engine::Init() {
65 TRACE_EVENT0("sky", "Engine::Init");
66
64 service_provider_ = CreateServiceProvider(); 67 service_provider_ = CreateServiceProvider();
65 mojo::NetworkServicePtr network_service; 68 mojo::NetworkServicePtr network_service;
66 mojo::ConnectToService(service_provider_.get(), &network_service); 69 mojo::ConnectToService(service_provider_.get(), &network_service);
67 platform_impl_.reset(new PlatformImpl(network_service.Pass())); 70 platform_impl_.reset(new PlatformImpl(network_service.Pass()));
68 71
69 blink::initialize(platform_impl_.get()); 72 blink::initialize(platform_impl_.get());
70 } 73 }
71 74
72 void Engine::BeginFrame(base::TimeTicks frame_time) { 75 void Engine::BeginFrame(base::TimeTicks frame_time) {
76 TRACE_EVENT0("sky", "Engine::BeginFrame");
77
73 double frame_time_sec = (frame_time - base::TimeTicks()).InSecondsF(); 78 double frame_time_sec = (frame_time - base::TimeTicks()).InSecondsF();
74 double deadline_sec = frame_time_sec; 79 double deadline_sec = frame_time_sec;
75 double interval_sec = 1.0 / 60; 80 double interval_sec = 1.0 / 60;
76 blink::WebBeginFrameArgs args(frame_time_sec, deadline_sec, interval_sec); 81 blink::WebBeginFrameArgs args(frame_time_sec, deadline_sec, interval_sec);
77 82
78 web_view_->beginFrame(args); 83 web_view_->beginFrame(args);
79 web_view_->layout(); 84 web_view_->layout();
80 } 85 }
81 86
82 skia::RefPtr<SkPicture> Engine::Paint() { 87 skia::RefPtr<SkPicture> Engine::Paint() {
88 TRACE_EVENT0("sky", "Engine::Paint");
89
83 SkRTreeFactory factory; 90 SkRTreeFactory factory;
84 SkPictureRecorder recorder; 91 SkPictureRecorder recorder;
85 auto canvas = skia::SharePtr(recorder.beginRecording( 92 auto canvas = skia::SharePtr(recorder.beginRecording(
86 physical_size_.width(), physical_size_.height(), &factory, 93 physical_size_.width(), physical_size_.height(), &factory,
87 SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag)); 94 SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag));
88 95
89 web_view_->paint(canvas.get(), blink::WebRect(gfx::Rect(physical_size_))); 96 web_view_->paint(canvas.get(), blink::WebRect(gfx::Rect(physical_size_)));
90 return skia::AdoptRef(recorder.endRecordingAsPicture()); 97 return skia::AdoptRef(recorder.endRecordingAsPicture());
91 } 98 }
92 99
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 // TODO(eseidel): This is likely not needed anymore. 137 // TODO(eseidel): This is likely not needed anymore.
131 blink::WebScreenInfo Engine::screenInfo() { 138 blink::WebScreenInfo Engine::screenInfo() {
132 blink::WebScreenInfo screen; 139 blink::WebScreenInfo screen;
133 screen.rect = blink::WebRect(gfx::Rect(physical_size_)); 140 screen.rect = blink::WebRect(gfx::Rect(physical_size_));
134 screen.availableRect = screen.rect; 141 screen.availableRect = screen.rect;
135 screen.deviceScaleFactor = device_pixel_ratio_; 142 screen.deviceScaleFactor = device_pixel_ratio_;
136 return screen; 143 return screen;
137 } 144 }
138 145
139 void Engine::OnInputEvent(InputEventPtr event) { 146 void Engine::OnInputEvent(InputEventPtr event) {
147 TRACE_EVENT0("sky", "Engine::OnInputEvent");
140 scoped_ptr<blink::WebInputEvent> web_event = 148 scoped_ptr<blink::WebInputEvent> web_event =
141 ConvertEvent(event, device_pixel_ratio_); 149 ConvertEvent(event, device_pixel_ratio_);
142 if (!web_event) 150 if (!web_event)
143 return; 151 return;
144 web_view_->handleInputEvent(*web_event); 152 web_view_->handleInputEvent(*web_event);
145 } 153 }
146 154
147 void Engine::LoadURL(const mojo::String& url) { 155 void Engine::LoadURL(const mojo::String& url) {
148 // Something bad happens if you try to call WebView::close and replace 156 // Something bad happens if you try to call WebView::close and replace
149 // the webview. So for now we just load into the existing one. :/ 157 // the webview. So for now we just load into the existing one. :/
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 197
190 void Engine::DidNavigateLocally(const mojo::String& url) { 198 void Engine::DidNavigateLocally(const mojo::String& url) {
191 } 199 }
192 200
193 void Engine::RequestNavigateHistory(int32_t delta) { 201 void Engine::RequestNavigateHistory(int32_t delta) {
194 NOTIMPLEMENTED(); 202 NOTIMPLEMENTED();
195 } 203 }
196 204
197 } // namespace shell 205 } // namespace shell
198 } // namespace sky 206 } // namespace sky
OLDNEW
« no previous file with comments | « sky/shell/gpu/rasterizer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698