| 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_SURFACES_DISPLAY_IMPL_H_ | |
| 6 #define COMPONENTS_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/surfaces/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 DisplayDamaged() override; | |
| 47 void DidSwapBuffers() override; | |
| 48 void DidSwapBuffersComplete() override; | |
| 49 void CommitVSyncParameters(base::TimeTicks timebase, | |
| 50 base::TimeDelta interval) override; | |
| 51 void OutputSurfaceLost() override; | |
| 52 void SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override; | |
| 53 | |
| 54 // ViewportParameterListener | |
| 55 void OnVSyncParametersUpdated(int64_t timebase, int64_t interval) override; | |
| 56 | |
| 57 // SurfaceFactoryClient implementation. | |
| 58 void ReturnResources(const cc::ReturnedResourceArray& resources) override; | |
| 59 | |
| 60 void Draw(); | |
| 61 | |
| 62 SurfacesServiceApplication* application_; | |
| 63 cc::SurfaceManager* manager_; | |
| 64 cc::SurfaceFactory factory_; | |
| 65 cc::SurfaceId cc_id_; | |
| 66 SurfacesScheduler* scheduler_; | |
| 67 mojo::ContextProviderPtr context_provider_; | |
| 68 mojo::ResourceReturnerPtr returner_; | |
| 69 | |
| 70 gfx::Size last_submitted_frame_size_; | |
| 71 mojo::FramePtr pending_frame_; | |
| 72 SubmitFrameCallback pending_callback_; | |
| 73 | |
| 74 scoped_ptr<cc::Display> display_; | |
| 75 | |
| 76 mojo::Binding<mojo::ViewportParameterListener> viewport_param_binding_; | |
| 77 mojo::StrongBinding<mojo::Display> display_binding_; | |
| 78 | |
| 79 DISALLOW_COPY_AND_ASSIGN(DisplayImpl); | |
| 80 }; | |
| 81 | |
| 82 } // namespace surfaces | |
| 83 | |
| 84 #endif // COMPONENTS_SURFACES_DISPLAY_IMPL_H_ | |
| OLD | NEW |