| 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 #ifndef SKY_SHELL_UI_ENGINE_H_ | 5 #ifndef SKY_SHELL_UI_ENGINE_H_ |
| 6 #define SKY_SHELL_UI_ENGINE_H_ | 6 #define SKY_SHELL_UI_ENGINE_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "sky/shell/service_provider.h" | 22 #include "sky/shell/service_provider.h" |
| 23 #include "third_party/skia/include/core/SkPicture.h" | 23 #include "third_party/skia/include/core/SkPicture.h" |
| 24 #include "ui/gfx/geometry/size.h" | 24 #include "ui/gfx/geometry/size.h" |
| 25 | 25 |
| 26 namespace sky { | 26 namespace sky { |
| 27 class PlatformImpl; | 27 class PlatformImpl; |
| 28 namespace shell { | 28 namespace shell { |
| 29 class Animator; | 29 class Animator; |
| 30 | 30 |
| 31 class Engine : public UIDelegate, | 31 class Engine : public UIDelegate, |
| 32 public ViewportObserver, | 32 public SkyEngine, |
| 33 public blink::ServiceProvider, | 33 public blink::ServiceProvider, |
| 34 public mojo::NavigatorHost, | 34 public mojo::NavigatorHost, |
| 35 public blink::SkyViewClient { | 35 public blink::SkyViewClient { |
| 36 public: | 36 public: |
| 37 struct Config { | 37 struct Config { |
| 38 Config(); | 38 Config(); |
| 39 ~Config(); | 39 ~Config(); |
| 40 | 40 |
| 41 ServiceProviderContext* service_provider_context; | 41 ServiceProviderContext* service_provider_context; |
| 42 | 42 |
| 43 base::WeakPtr<GPUDelegate> gpu_delegate; | 43 base::WeakPtr<GPUDelegate> gpu_delegate; |
| 44 scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner; | 44 scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner; |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 explicit Engine(const Config& config); | 47 explicit Engine(const Config& config); |
| 48 ~Engine() override; | 48 ~Engine() override; |
| 49 | 49 |
| 50 base::WeakPtr<Engine> GetWeakPtr(); | 50 base::WeakPtr<Engine> GetWeakPtr(); |
| 51 | 51 |
| 52 static void Init(ServiceProviderContext* service_provider_context); | 52 static void Init(ServiceProviderContext* service_provider_context); |
| 53 | 53 |
| 54 void BeginFrame(base::TimeTicks frame_time); | 54 void BeginFrame(base::TimeTicks frame_time); |
| 55 skia::RefPtr<SkPicture> Paint(); | 55 skia::RefPtr<SkPicture> Paint(); |
| 56 | 56 |
| 57 private: | 57 private: |
| 58 // UIDelegate methods: | 58 // UIDelegate implementation: |
| 59 void ConnectToViewportObserver( | 59 void ConnectToEngine(mojo::InterfaceRequest<SkyEngine> request) override; |
| 60 mojo::InterfaceRequest<ViewportObserver> request) override; | |
| 61 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) override; | 60 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) override; |
| 62 void OnOutputSurfaceDestroyed() override; | 61 void OnOutputSurfaceDestroyed() override; |
| 63 | 62 |
| 64 // ViewportObserver: | 63 // SkyEngine implementation: |
| 65 void OnViewportMetricsChanged(int width, int height, | 64 void OnViewportMetricsChanged(int width, int height, |
| 66 float device_pixel_ratio) override; | 65 float device_pixel_ratio) override; |
| 67 void OnInputEvent(InputEventPtr event) override; | 66 void OnInputEvent(InputEventPtr event) override; |
| 68 | 67 |
| 69 void RunFromNetwork(const mojo::String& url) override; | 68 void RunFromNetwork(const mojo::String& url) override; |
| 70 void RunFromFile(const mojo::String& main, | 69 void RunFromFile(const mojo::String& main, |
| 71 const mojo::String& package_root) override; | 70 const mojo::String& package_root) override; |
| 72 void RunFromSnapshot(const mojo::String& path) override; | 71 void RunFromSnapshot(const mojo::String& path) override; |
| 73 | 72 |
| 74 // SkyViewClient methods: | 73 // SkyViewClient methods: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 89 void UpdateSkyViewSize(); | 88 void UpdateSkyViewSize(); |
| 90 | 89 |
| 91 Config config_; | 90 Config config_; |
| 92 scoped_ptr<Animator> animator_; | 91 scoped_ptr<Animator> animator_; |
| 93 | 92 |
| 94 scoped_ptr<blink::DartLibraryProvider> dart_library_provider_; | 93 scoped_ptr<blink::DartLibraryProvider> dart_library_provider_; |
| 95 std::unique_ptr<blink::SkyView> sky_view_; | 94 std::unique_ptr<blink::SkyView> sky_view_; |
| 96 | 95 |
| 97 float device_pixel_ratio_; | 96 float device_pixel_ratio_; |
| 98 gfx::Size physical_size_; | 97 gfx::Size physical_size_; |
| 99 mojo::Binding<ViewportObserver> viewport_observer_binding_; | 98 mojo::Binding<SkyEngine> binding_; |
| 100 | 99 |
| 101 base::WeakPtrFactory<Engine> weak_factory_; | 100 base::WeakPtrFactory<Engine> weak_factory_; |
| 102 | 101 |
| 103 DISALLOW_COPY_AND_ASSIGN(Engine); | 102 DISALLOW_COPY_AND_ASSIGN(Engine); |
| 104 }; | 103 }; |
| 105 | 104 |
| 106 } // namespace shell | 105 } // namespace shell |
| 107 } // namespace sky | 106 } // namespace sky |
| 108 | 107 |
| 109 #endif // SKY_SHELL_UI_ENGINE_H_ | 108 #endif // SKY_SHELL_UI_ENGINE_H_ |
| OLD | NEW |