| 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" |
| 11 #include "base/single_thread_task_runner.h" |
| 12 #include "mojo/public/cpp/system/core.h" |
| 13 #include "skia/ext/refptr.h" |
| 11 #include "sky/engine/public/web/WebFrameClient.h" | 14 #include "sky/engine/public/web/WebFrameClient.h" |
| 12 #include "sky/engine/public/web/WebViewClient.h" | 15 #include "sky/engine/public/web/WebViewClient.h" |
| 16 #include "sky/shell/gpu_delegate.h" |
| 13 #include "sky/shell/ui_delegate.h" | 17 #include "sky/shell/ui_delegate.h" |
| 18 #include "third_party/skia/include/core/SkPicture.h" |
| 14 #include "ui/gfx/geometry/size.h" | 19 #include "ui/gfx/geometry/size.h" |
| 15 | 20 |
| 16 namespace sky { | 21 namespace sky { |
| 17 namespace shell { | 22 namespace shell { |
| 23 class Animator; |
| 18 class PlatformImpl; | 24 class PlatformImpl; |
| 19 | 25 |
| 20 class Engine : public UIDelegate, | 26 class Engine : public UIDelegate, |
| 21 public blink::WebFrameClient, | 27 public blink::WebFrameClient, |
| 22 public blink::WebViewClient { | 28 public blink::WebViewClient { |
| 23 public: | 29 public: |
| 24 Engine(); | 30 struct Config { |
| 31 base::WeakPtr<GPUDelegate> gpu_delegate; |
| 32 scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner; |
| 33 }; |
| 34 |
| 35 explicit Engine(const Config& config); |
| 25 ~Engine() override; | 36 ~Engine() override; |
| 26 | 37 |
| 27 base::WeakPtr<Engine> GetWeakPtr(); | 38 base::WeakPtr<Engine> GetWeakPtr(); |
| 28 | 39 |
| 29 void Init(); | 40 void Init(mojo::ScopedMessagePipeHandle service_provider); |
| 30 | 41 |
| 31 void OnViewportMetricsChanged(const gfx::Size& size, | 42 void BeginFrame(base::TimeTicks frame_time); |
| 43 skia::RefPtr<SkPicture> Paint(); |
| 44 |
| 45 private: |
| 46 // UIDelegate methods: |
| 47 void OnViewportMetricsChanged(const gfx::Size& physical_size, |
| 32 float device_pixel_ratio) override; | 48 float device_pixel_ratio) override; |
| 33 | 49 |
| 34 private: | 50 // WebViewClient methods: |
| 51 void initializeLayerTreeView() override; |
| 52 void scheduleVisualUpdate() override; |
| 53 |
| 35 scoped_ptr<PlatformImpl> platform_impl_; | 54 scoped_ptr<PlatformImpl> platform_impl_; |
| 55 scoped_ptr<Animator> animator_; |
| 36 blink::WebView* web_view_; | 56 blink::WebView* web_view_; |
| 57 gfx::Size physical_size_; |
| 37 | 58 |
| 38 base::WeakPtrFactory<Engine> weak_factory_; | 59 base::WeakPtrFactory<Engine> weak_factory_; |
| 39 | 60 |
| 40 DISALLOW_COPY_AND_ASSIGN(Engine); | 61 DISALLOW_COPY_AND_ASSIGN(Engine); |
| 41 }; | 62 }; |
| 42 | 63 |
| 43 } // namespace shell | 64 } // namespace shell |
| 44 } // namespace sky | 65 } // namespace sky |
| 45 | 66 |
| 46 #endif // SKY_SHELL_UI_ENGINE_H_ | 67 #endif // SKY_SHELL_UI_ENGINE_H_ |
| OLD | NEW |