| OLD | NEW |
| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 Engine::Config::Config() { | 47 Engine::Config::Config() { |
| 48 } | 48 } |
| 49 | 49 |
| 50 Engine::Config::~Config() { | 50 Engine::Config::~Config() { |
| 51 } | 51 } |
| 52 | 52 |
| 53 Engine::Engine(const Config& config) | 53 Engine::Engine(const Config& config) |
| 54 : config_(config), | 54 : config_(config), |
| 55 animator_(new Animator(config, this)), | 55 animator_(new Animator(config, this)), |
| 56 device_pixel_ratio_(1.0f), | 56 device_pixel_ratio_(1.0f), |
| 57 viewport_observer_binding_(this), | 57 binding_(this), |
| 58 weak_factory_(this) { | 58 weak_factory_(this) { |
| 59 } | 59 } |
| 60 | 60 |
| 61 Engine::~Engine() { | 61 Engine::~Engine() { |
| 62 } | 62 } |
| 63 | 63 |
| 64 base::WeakPtr<Engine> Engine::GetWeakPtr() { | 64 base::WeakPtr<Engine> Engine::GetWeakPtr() { |
| 65 return weak_factory_.GetWeakPtr(); | 65 return weak_factory_.GetWeakPtr(); |
| 66 } | 66 } |
| 67 | 67 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 98 skia::RefPtr<SkPicture> picture = sky_view_->Paint(); | 98 skia::RefPtr<SkPicture> picture = sky_view_->Paint(); |
| 99 canvas->clear(SK_ColorBLACK); | 99 canvas->clear(SK_ColorBLACK); |
| 100 canvas->scale(device_pixel_ratio_, device_pixel_ratio_); | 100 canvas->scale(device_pixel_ratio_, device_pixel_ratio_); |
| 101 if (picture) | 101 if (picture) |
| 102 canvas->drawPicture(picture.get()); | 102 canvas->drawPicture(picture.get()); |
| 103 } | 103 } |
| 104 | 104 |
| 105 return skia::AdoptRef(recorder.endRecordingAsPicture()); | 105 return skia::AdoptRef(recorder.endRecordingAsPicture()); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void Engine::ConnectToViewportObserver( | 108 void Engine::ConnectToEngine(mojo::InterfaceRequest<SkyEngine> request) { |
| 109 mojo::InterfaceRequest<ViewportObserver> request) { | 109 binding_.Bind(request.Pass()); |
| 110 viewport_observer_binding_.Bind(request.Pass()); | |
| 111 } | 110 } |
| 112 | 111 |
| 113 void Engine::OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) { | 112 void Engine::OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) { |
| 114 config_.gpu_task_runner->PostTask( | 113 config_.gpu_task_runner->PostTask( |
| 115 FROM_HERE, base::Bind(&GPUDelegate::OnAcceleratedWidgetAvailable, | 114 FROM_HERE, base::Bind(&GPUDelegate::OnAcceleratedWidgetAvailable, |
| 116 config_.gpu_delegate, widget)); | 115 config_.gpu_delegate, widget)); |
| 117 if (sky_view_) | 116 if (sky_view_) |
| 118 ScheduleFrame(); | 117 ScheduleFrame(); |
| 119 } | 118 } |
| 120 | 119 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 | 200 |
| 202 void Engine::DidNavigateLocally(const mojo::String& url) { | 201 void Engine::DidNavigateLocally(const mojo::String& url) { |
| 203 } | 202 } |
| 204 | 203 |
| 205 void Engine::RequestNavigateHistory(int32_t delta) { | 204 void Engine::RequestNavigateHistory(int32_t delta) { |
| 206 NOTIMPLEMENTED(); | 205 NOTIMPLEMENTED(); |
| 207 } | 206 } |
| 208 | 207 |
| 209 } // namespace shell | 208 } // namespace shell |
| 210 } // namespace sky | 209 } // namespace sky |
| OLD | NEW |