| 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 EXAMPLES_UI_NOODLES_NOODLES_VIEW_H_ | 5 #ifndef EXAMPLES_UI_NOODLES_NOODLES_VIEW_H_ |
| 6 #define EXAMPLES_UI_NOODLES_NOODLES_VIEW_H_ | 6 #define EXAMPLES_UI_NOODLES_NOODLES_VIEW_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <mutex> | 9 #include <mutex> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 15 #include "base/threading/thread.h" | 15 #include "base/threading/thread.h" |
| 16 #include "mojo/ui/base_view.h" | 16 #include "mojo/ui/base_view.h" |
| 17 #include "mojo/ui/choreographer.h" | 17 #include "mojo/ui/choreographer.h" |
| 18 #include "skia/ext/refptr.h" | 18 #include "third_party/skia/include/core/SkRefCnt.h" |
| 19 | 19 |
| 20 class SkPicture; | 20 class SkPicture; |
| 21 | 21 |
| 22 namespace examples { | 22 namespace examples { |
| 23 | 23 |
| 24 class Frame; | 24 class Frame; |
| 25 class Rasterizer; | 25 class Rasterizer; |
| 26 | 26 |
| 27 class NoodlesView : public mojo::ui::BaseView, | 27 class NoodlesView : public mojo::ui::BaseView, |
| 28 public mojo::ui::ChoreographerDelegate { | 28 public mojo::ui::ChoreographerDelegate { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 // |BaseView|: | 76 // |BaseView|: |
| 77 void OnPropertiesChanged(uint32_t old_scene_version, | 77 void OnPropertiesChanged(uint32_t old_scene_version, |
| 78 mojo::ui::ViewPropertiesPtr old_properties) override; | 78 mojo::ui::ViewPropertiesPtr old_properties) override; |
| 79 | 79 |
| 80 // |ChoreographerDelegate|: | 80 // |ChoreographerDelegate|: |
| 81 void OnDraw(const mojo::gfx::composition::FrameInfo& frame_info, | 81 void OnDraw(const mojo::gfx::composition::FrameInfo& frame_info, |
| 82 const base::TimeDelta& time_delta) override; | 82 const base::TimeDelta& time_delta) override; |
| 83 | 83 |
| 84 void UpdateFrame(); | 84 void UpdateFrame(); |
| 85 skia::RefPtr<SkPicture> CreatePicture(); | 85 sk_sp<SkPicture> CreatePicture(); |
| 86 | 86 |
| 87 mojo::ui::Choreographer choreographer_; | 87 mojo::ui::Choreographer choreographer_; |
| 88 | 88 |
| 89 std::shared_ptr<FrameQueue> frame_queue_; | 89 std::shared_ptr<FrameQueue> frame_queue_; |
| 90 | 90 |
| 91 scoped_ptr<RasterizerDelegate> rasterizer_delegate_; // can't use unique_ptr | 91 scoped_ptr<RasterizerDelegate> rasterizer_delegate_; // can't use unique_ptr |
| 92 // here due to | 92 // here due to |
| 93 // base::Bind (sadness) | 93 // base::Bind (sadness) |
| 94 std::unique_ptr<base::Thread> rasterizer_thread_; | 94 std::unique_ptr<base::Thread> rasterizer_thread_; |
| 95 scoped_refptr<base::SingleThreadTaskRunner> rasterizer_task_runner_; | 95 scoped_refptr<base::SingleThreadTaskRunner> rasterizer_task_runner_; |
| 96 | 96 |
| 97 double alpha_ = 0.0; | 97 double alpha_ = 0.0; |
| 98 int wx_ = 2; | 98 int wx_ = 2; |
| 99 int wy_ = 3; | 99 int wy_ = 3; |
| 100 | 100 |
| 101 DISALLOW_COPY_AND_ASSIGN(NoodlesView); | 101 DISALLOW_COPY_AND_ASSIGN(NoodlesView); |
| 102 }; | 102 }; |
| 103 | 103 |
| 104 } // namespace examples | 104 } // namespace examples |
| 105 | 105 |
| 106 #endif // EXAMPLES_UI_NOODLES_NOODLES_VIEW_H_ | 106 #endif // EXAMPLES_UI_NOODLES_NOODLES_VIEW_H_ |
| OLD | NEW |