cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / components / view_manager / surfaces / top_level_display_client.h
blobae87d964f5b3fd98234d2666b2d2d9b7368b094b
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.
5 #ifndef COMPONENTS_VIEW_MANAGER_SURFACES_DISPLAY_IMPL_H_
6 #define COMPONENTS_VIEW_MANAGER_SURFACES_DISPLAY_IMPL_H_
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/surfaces/surfaces_context_provider.h"
13 #include "components/view_manager/surfaces/surfaces_context_provider_delegate.h"
14 #include "components/view_manager/surfaces/surfaces_state.h"
15 #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
16 #include "ui/gfx/native_widget_types.h"
18 namespace cc {
19 class Display;
20 class SurfaceFactory;
23 namespace gles2 {
24 class GpuState;
27 namespace surfaces {
29 class DisplayDelegate;
30 class SurfacesScheduler;
31 class SurfacesState;
33 // A TopLevelDisplayClient manages the top level surface that is rendered into a
34 // provided AcceleratedWidget. Frames are submitted here. New frames are
35 // scheduled to be generated here based on VSync.
36 class TopLevelDisplayClient
37 : public cc::DisplayClient,
38 public cc::SurfaceFactoryClient,
39 public surfaces::SurfacesContextProviderDelegate {
40 public:
41 TopLevelDisplayClient(gfx::AcceleratedWidget widget,
42 const scoped_refptr<gles2::GpuState>& gpu_state,
43 const scoped_refptr<SurfacesState>& surfaces_state);
44 ~TopLevelDisplayClient() override;
46 void SubmitCompositorFrame(scoped_ptr<cc::CompositorFrame> frame,
47 const base::Closure& callback);
49 private:
50 // DisplayClient implementation.
51 // TODO(rjkroege, fsamuel): This won't work correctly with multiple displays.
52 void CommitVSyncParameters(base::TimeTicks timebase,
53 base::TimeDelta interval) override;
54 void OutputSurfaceLost() override;
55 void SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override;
57 // SurfacesContextProviderDelegate:
58 void OnContextCreated();
59 void OnVSyncParametersUpdated(int64_t timebase, int64_t interval) override;
61 // SurfaceFactoryClient implementation.
62 void ReturnResources(const cc::ReturnedResourceArray& resources) override;
64 void Draw();
66 scoped_refptr<gles2::GpuState> gpu_state_;
67 scoped_refptr<SurfacesState> surfaces_state_;
68 cc::SurfaceFactory factory_;
69 cc::SurfaceId cc_id_;
71 gfx::Size last_submitted_frame_size_;
72 scoped_ptr<cc::CompositorFrame> pending_frame_;
73 base::Closure pending_callback_;
75 scoped_ptr<cc::Display> display_;
77 DISALLOW_COPY_AND_ASSIGN(TopLevelDisplayClient);
80 } // namespace surfaces
82 #endif // COMPONENTS_VIEW_MANAGER_SURFACES_DISPLAY_IMPL_H_