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_ENGINE_CORE_VIEW_VIEW_H_ | 5 #ifndef SKY_ENGINE_CORE_VIEW_VIEW_H_ |
6 #define SKY_ENGINE_CORE_VIEW_VIEW_H_ | 6 #define SKY_ENGINE_CORE_VIEW_VIEW_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/time/time.h" |
9 #include "sky/engine/core/painting/Picture.h" | 10 #include "sky/engine/core/painting/Picture.h" |
| 11 #include "sky/engine/core/view/BeginFrameCallback.h" |
10 #include "sky/engine/core/view/EventCallback.h" | 12 #include "sky/engine/core/view/EventCallback.h" |
11 #include "sky/engine/public/platform/sky_display_metrics.h" | 13 #include "sky/engine/public/platform/sky_display_metrics.h" |
12 #include "sky/engine/tonic/dart_wrappable.h" | 14 #include "sky/engine/tonic/dart_wrappable.h" |
13 #include "sky/engine/wtf/PassRefPtr.h" | 15 #include "sky/engine/wtf/PassRefPtr.h" |
14 #include "sky/engine/wtf/RefCounted.h" | 16 #include "sky/engine/wtf/RefCounted.h" |
15 | 17 |
16 namespace blink { | 18 namespace blink { |
17 | 19 |
18 class View : public RefCounted<View>, public DartWrappable { | 20 class View : public RefCounted<View>, public DartWrappable { |
19 DEFINE_WRAPPERTYPEINFO(); | 21 DEFINE_WRAPPERTYPEINFO(); |
20 public: | 22 public: |
21 ~View() override; | 23 ~View() override; |
22 static PassRefPtr<View> create(const base::Closure& schedulePaintCallback); | 24 static PassRefPtr<View> create(const base::Closure& scheduleFrameCallback); |
23 | 25 |
24 double devicePixelRatio() const { return m_displayMetrics.device_pixel_ratio
; } | 26 double devicePixelRatio() const { return m_displayMetrics.device_pixel_ratio
; } |
25 double width() const; | 27 double width() const; |
26 double height() const; | 28 double height() const; |
27 | 29 |
28 Picture* picture() const { return m_picture.get(); } | 30 Picture* picture() const { return m_picture.get(); } |
29 void setPicture(Picture* picture) { m_picture = picture; } | 31 void setPicture(Picture* picture) { m_picture = picture; } |
30 | 32 |
31 void setEventCallback(PassOwnPtr<EventCallback> callback); | 33 void setEventCallback(PassOwnPtr<EventCallback> callback); |
32 | 34 |
33 void schedulePaint(); | 35 void setBeginFrameCallback(PassOwnPtr<BeginFrameCallback> callback); |
| 36 void scheduleFrame(); |
34 | 37 |
35 void setDisplayMetrics(const SkyDisplayMetrics& metrics); | 38 void setDisplayMetrics(const SkyDisplayMetrics& metrics); |
36 bool handleInputEvent(PassRefPtr<Event> event); | 39 bool handleInputEvent(PassRefPtr<Event> event); |
| 40 void beginFrame(base::TimeTicks frameTime); |
37 | 41 |
38 private: | 42 private: |
39 explicit View(const base::Closure& schedulePaintCallback); | 43 explicit View(const base::Closure& scheduleFrameCallback); |
40 | 44 |
41 base::Closure m_schedulePaintCallback; | 45 base::Closure m_scheduleFrameCallback; |
42 SkyDisplayMetrics m_displayMetrics; | 46 SkyDisplayMetrics m_displayMetrics; |
43 OwnPtr<EventCallback> m_eventCallback; | 47 OwnPtr<EventCallback> m_eventCallback; |
| 48 OwnPtr<BeginFrameCallback> m_beginFrameCallback; |
44 RefPtr<Picture> m_picture; | 49 RefPtr<Picture> m_picture; |
45 }; | 50 }; |
46 | 51 |
47 } // namespace blink | 52 } // namespace blink |
48 | 53 |
49 #endif // SKY_ENGINE_CORE_VIEW_VIEW_H_ | 54 #endif // SKY_ENGINE_CORE_VIEW_VIEW_H_ |
OLD | NEW |