| 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 "examples/ui/noodles/noodles_view.h" | 5 #include "examples/ui/noodles/noodles_view.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include <cstdlib> | 9 #include <cstdlib> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 path->moveTo(x, y); | 43 path->moveTo(x, y); |
| 44 else | 44 else |
| 45 path->lineTo(x, y); | 45 path->lineTo(x, y); |
| 46 } | 46 } |
| 47 path->close(); | 47 path->close(); |
| 48 } | 48 } |
| 49 } // namespace | 49 } // namespace |
| 50 | 50 |
| 51 NoodlesView::NoodlesView( | 51 NoodlesView::NoodlesView( |
| 52 mojo::ApplicationImpl* app_impl, | 52 mojo::ApplicationImpl* app_impl, |
| 53 const mojo::ui::ViewProvider::CreateViewCallback& create_view_callback) | 53 mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request) |
| 54 : BaseView(app_impl, "Noodles", create_view_callback), | 54 : BaseView(app_impl, view_owner_request.Pass(), "Noodles"), |
| 55 choreographer_(scene(), this), | 55 choreographer_(scene(), this), |
| 56 frame_queue_(std::make_shared<FrameQueue>()), | 56 frame_queue_(std::make_shared<FrameQueue>()), |
| 57 rasterizer_delegate_( | 57 rasterizer_delegate_( |
| 58 make_scoped_ptr(new RasterizerDelegate(frame_queue_))) { | 58 make_scoped_ptr(new RasterizerDelegate(frame_queue_))) { |
| 59 base::Thread::Options options; | 59 base::Thread::Options options; |
| 60 options.message_pump_factory = base::Bind(&CreateMessagePumpMojo); | 60 options.message_pump_factory = base::Bind(&CreateMessagePumpMojo); |
| 61 | 61 |
| 62 rasterizer_thread_.reset(new base::Thread("noodles_rasterizer")); | 62 rasterizer_thread_.reset(new base::Thread("noodles_rasterizer")); |
| 63 rasterizer_thread_->StartWithOptions(options); | 63 rasterizer_thread_->StartWithOptions(options); |
| 64 rasterizer_task_runner_ = rasterizer_thread_->message_loop()->task_runner(); | 64 rasterizer_task_runner_ = rasterizer_thread_->message_loop()->task_runner(); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 mojo::gfx::composition::ScenePtr::Create(std::move(scene_info)))); | 176 mojo::gfx::composition::ScenePtr::Create(std::move(scene_info)))); |
| 177 } | 177 } |
| 178 | 178 |
| 179 void NoodlesView::RasterizerDelegate::PublishNextFrame() { | 179 void NoodlesView::RasterizerDelegate::PublishNextFrame() { |
| 180 std::unique_ptr<Frame> frame(frame_queue_->TakeFrame()); | 180 std::unique_ptr<Frame> frame(frame_queue_->TakeFrame()); |
| 181 DCHECK(frame); | 181 DCHECK(frame); |
| 182 rasterizer_->PublishFrame(std::move(frame)); | 182 rasterizer_->PublishFrame(std::move(frame)); |
| 183 } | 183 } |
| 184 | 184 |
| 185 } // namespace examples | 185 } // namespace examples |
| OLD | NEW |