| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_VIEW_MANAGER_SURFACES_DISPLAY_IMPL_H_ | |
| 6 #define COMPONENTS_VIEW_MANAGER_SURFACES_DISPLAY_IMPL_H_ | |
| 7 | |
| 8 #include "base/memory/scoped_ptr.h" | |
| 9 #include "cc/surfaces/display_client.h" | |
| 10 #include "cc/surfaces/surface_factory.h" | |
| 11 #include "cc/surfaces/surface_factory_client.h" | |
| 12 #include "components/view_manager/public/interfaces/display.mojom.h" | |
| 13 #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h" | |
| 14 | |
| 15 namespace cc { | |
| 16 class Display; | |
| 17 class SurfaceFactory; | |
| 18 } | |
| 19 | |
| 20 namespace surfaces { | |
| 21 class SurfacesScheduler; | |
| 22 class SurfacesServiceApplication; | |
| 23 | |
| 24 class DisplayImpl : public mojo::Display, | |
| 25 public mojo::ViewportParameterListener, | |
| 26 public cc::DisplayClient, | |
| 27 public cc::SurfaceFactoryClient { | |
| 28 public: | |
| 29 DisplayImpl(SurfacesServiceApplication* application, | |
| 30 cc::SurfaceManager* manager, | |
| 31 cc::SurfaceId cc_id, | |
| 32 SurfacesScheduler* scheduler, | |
| 33 mojo::ContextProviderPtr context_provider, | |
| 34 mojo::ResourceReturnerPtr returner, | |
| 35 mojo::InterfaceRequest<mojo::Display> display_request); | |
| 36 ~DisplayImpl() override; | |
| 37 | |
| 38 private: | |
| 39 void OnContextCreated(mojo::CommandBufferPtr gles2_client); | |
| 40 | |
| 41 // mojo::Display implementation: | |
| 42 void SubmitFrame(mojo::FramePtr frame, | |
| 43 const SubmitFrameCallback& callback) override; | |
| 44 | |
| 45 // DisplayClient implementation. | |
| 46 void CommitVSyncParameters(base::TimeTicks timebase, | |
| 47 base::TimeDelta interval) override; | |
| 48 void OutputSurfaceLost() override; | |
| 49 void SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override; | |
| 50 | |
| 51 // ViewportParameterListener | |
| 52 void OnVSyncParametersUpdated(int64_t timebase, int64_t interval) override; | |
| 53 | |
| 54 // SurfaceFactoryClient implementation. | |
| 55 void ReturnResources(const cc::ReturnedResourceArray& resources) override; | |
| 56 | |
| 57 void Draw(); | |
| 58 | |
| 59 SurfacesServiceApplication* application_; | |
| 60 cc::SurfaceManager* manager_; | |
| 61 cc::SurfaceFactory factory_; | |
| 62 cc::SurfaceId cc_id_; | |
| 63 SurfacesScheduler* scheduler_; | |
| 64 mojo::ContextProviderPtr context_provider_; | |
| 65 mojo::ResourceReturnerPtr returner_; | |
| 66 | |
| 67 gfx::Size last_submitted_frame_size_; | |
| 68 mojo::FramePtr pending_frame_; | |
| 69 SubmitFrameCallback pending_callback_; | |
| 70 | |
| 71 scoped_ptr<cc::Display> display_; | |
| 72 | |
| 73 mojo::Binding<mojo::ViewportParameterListener> viewport_param_binding_; | |
| 74 mojo::StrongBinding<mojo::Display> display_binding_; | |
| 75 | |
| 76 DISALLOW_COPY_AND_ASSIGN(DisplayImpl); | |
| 77 }; | |
| 78 | |
| 79 } // namespace surfaces | |
| 80 | |
| 81 #endif // COMPONENTS_VIEW_MANAGER_SURFACES_DISPLAY_IMPL_H_ | |
| OLD | NEW |