| 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 "components/view_manager/surfaces/surfaces_state.h" | |
| 14 #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h" | |
| 15 | |
| 16 namespace cc { | |
| 17 class Display; | |
| 18 class SurfaceFactory; | |
| 19 } | |
| 20 | |
| 21 namespace surfaces { | |
| 22 | |
| 23 class DisplayDelegate; | |
| 24 | |
| 25 class DisplayImpl : public mojo::Display, | |
| 26 public mojo::ViewportParameterListener, | |
| 27 public cc::DisplayClient, | |
| 28 public cc::SurfaceFactoryClient { | |
| 29 public: | |
| 30 DisplayImpl(DisplayDelegate* display_delegate, | |
| 31 const scoped_refptr<SurfacesState>& surfaces_state, | |
| 32 cc::SurfaceId cc_id, | |
| 33 mojo::ContextProviderPtr context_provider, | |
| 34 mojo::ResourceReturnerPtr returner, | |
| 35 mojo::InterfaceRequest<mojo::Display> display_request); | |
| 36 | |
| 37 // Closes the connection and destroys |this| object. | |
| 38 void CloseConnection(); | |
| 39 | |
| 40 private: | |
| 41 ~DisplayImpl() override; | |
| 42 | |
| 43 void OnContextCreated(mojo::CommandBufferPtr gles2_client); | |
| 44 | |
| 45 // mojo::Display implementation: | |
| 46 void SubmitFrame(mojo::FramePtr frame, | |
| 47 const SubmitFrameCallback& callback) override; | |
| 48 | |
| 49 // DisplayClient implementation. | |
| 50 // TODO(rjkroege, fsamuel): This won't work correctly with multiple displays. | |
| 51 void CommitVSyncParameters(base::TimeTicks timebase, | |
| 52 base::TimeDelta interval) override; | |
| 53 void OutputSurfaceLost() override; | |
| 54 void SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override; | |
| 55 | |
| 56 // ViewportParameterListener | |
| 57 void OnVSyncParametersUpdated(int64_t timebase, int64_t interval) override; | |
| 58 | |
| 59 // SurfaceFactoryClient implementation. | |
| 60 void ReturnResources(const cc::ReturnedResourceArray& resources) override; | |
| 61 | |
| 62 void Draw(); | |
| 63 | |
| 64 DisplayDelegate* delegate_; | |
| 65 scoped_refptr<SurfacesState> surfaces_state_; | |
| 66 cc::SurfaceFactory factory_; | |
| 67 cc::SurfaceId cc_id_; | |
| 68 mojo::ContextProviderPtr context_provider_; | |
| 69 mojo::ResourceReturnerPtr returner_; | |
| 70 | |
| 71 gfx::Size last_submitted_frame_size_; | |
| 72 mojo::FramePtr pending_frame_; | |
| 73 SubmitFrameCallback pending_callback_; | |
| 74 | |
| 75 scoped_ptr<cc::Display> display_; | |
| 76 | |
| 77 mojo::Binding<mojo::ViewportParameterListener> viewport_param_binding_; | |
| 78 mojo::Binding<mojo::Display> display_binding_; | |
| 79 bool connection_closed_; | |
| 80 | |
| 81 DISALLOW_COPY_AND_ASSIGN(DisplayImpl); | |
| 82 }; | |
| 83 | |
| 84 } // namespace surfaces | |
| 85 | |
| 86 #endif // COMPONENTS_VIEW_MANAGER_SURFACES_DISPLAY_IMPL_H_ | |
| OLD | NEW |