Add ICU message format support
[chromium-blink-merge.git] / cc / surfaces / display.h
blobb849b461afb69bbf506b9a330635e8e3edc7d171
1 // Copyright 2014 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 CC_SURFACES_DISPLAY_H_
6 #define CC_SURFACES_DISPLAY_H_
8 #include <vector>
10 #include "base/memory/scoped_ptr.h"
11 #include "cc/output/output_surface_client.h"
12 #include "cc/output/renderer.h"
13 #include "cc/resources/returned_resource.h"
14 #include "cc/surfaces/display_scheduler.h"
15 #include "cc/surfaces/surface_aggregator.h"
16 #include "cc/surfaces/surface_id.h"
17 #include "cc/surfaces/surface_manager.h"
18 #include "cc/surfaces/surfaces_export.h"
19 #include "ui/events/latency_info.h"
21 namespace gpu {
22 class GpuMemoryBufferManager;
25 namespace gfx {
26 class Size;
29 namespace cc {
31 class DirectRenderer;
32 class DisplayClient;
33 class OutputSurface;
34 class RendererSettings;
35 class ResourceProvider;
36 class SharedBitmapManager;
37 class Surface;
38 class SurfaceAggregator;
39 class SurfaceIdAllocator;
40 class SurfaceFactory;
41 class TextureMailboxDeleter;
43 // A Display produces a surface that can be used to draw to a physical display
44 // (OutputSurface). The client is responsible for creating and sizing the
45 // surface IDs used to draw into the display and deciding when to draw.
46 class CC_SURFACES_EXPORT Display : public DisplaySchedulerClient,
47 public OutputSurfaceClient,
48 public RendererClient,
49 public SurfaceDamageObserver {
50 public:
51 Display(DisplayClient* client,
52 SurfaceManager* manager,
53 SharedBitmapManager* bitmap_manager,
54 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
55 const RendererSettings& settings);
56 ~Display() override;
58 bool Initialize(scoped_ptr<OutputSurface> output_surface,
59 DisplayScheduler* scheduler);
61 // device_scale_factor is used to communicate to the external window system
62 // what scale this was rendered at.
63 void SetSurfaceId(SurfaceId id, float device_scale_factor);
64 void Resize(const gfx::Size& new_size);
65 void SetExternalClip(const gfx::Rect& clip);
67 SurfaceId CurrentSurfaceId();
69 // DisplaySchedulerClient implementation.
70 bool DrawAndSwap() override;
72 // OutputSurfaceClient implementation.
73 void CommitVSyncParameters(base::TimeTicks timebase,
74 base::TimeDelta interval) override;
75 void SetNeedsRedrawRect(const gfx::Rect& damage_rect) override;
76 void DidSwapBuffers() override;
77 void DidSwapBuffersComplete() override;
78 void ReclaimResources(const CompositorFrameAck* ack) override;
79 void DidLoseOutputSurface() override;
80 void SetExternalDrawConstraints(
81 const gfx::Transform& transform,
82 const gfx::Rect& viewport,
83 const gfx::Rect& clip,
84 const gfx::Rect& viewport_rect_for_tile_priority,
85 const gfx::Transform& transform_for_tile_priority,
86 bool resourceless_software_draw) override;
87 void SetMemoryPolicy(const ManagedMemoryPolicy& policy) override;
88 void SetTreeActivationCallback(const base::Closure& callback) override;
89 void OnDraw() override;
91 // RendererClient implementation.
92 void SetFullRootLayerDamage() override;
94 // SurfaceDamageObserver implementation.
95 void OnSurfaceDamaged(SurfaceId surface, bool* changed) override;
97 private:
98 void InitializeRenderer();
99 void UpdateRootSurfaceResourcesLocked();
101 DisplayClient* client_;
102 SurfaceManager* manager_;
103 SharedBitmapManager* bitmap_manager_;
104 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_;
105 RendererSettings settings_;
106 SurfaceId current_surface_id_;
107 gfx::Size current_surface_size_;
108 float device_scale_factor_;
109 bool swapped_since_resize_;
110 gfx::Rect external_clip_;
111 scoped_ptr<OutputSurface> output_surface_;
112 DisplayScheduler* scheduler_;
113 scoped_ptr<ResourceProvider> resource_provider_;
114 scoped_ptr<SurfaceAggregator> aggregator_;
115 scoped_ptr<DirectRenderer> renderer_;
116 scoped_ptr<TextureMailboxDeleter> texture_mailbox_deleter_;
117 std::vector<ui::LatencyInfo> stored_latency_info_;
119 DISALLOW_COPY_AND_ASSIGN(Display);
122 } // namespace cc
124 #endif // CC_SURFACES_DISPLAY_H_