NaCl: Increase validation cache size.
[chromium-blink-merge.git] / components / html_viewer / web_layer_tree_view_impl.h
blob709d3310b6de5b2923dabb665c3d50934fbe2ec2
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 COMPONENTS_HTML_VIEWER_WEB_LAYER_TREE_VIEW_IMPL_H_
6 #define COMPONENTS_HTML_VIEWER_WEB_LAYER_TREE_VIEW_IMPL_H_
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/single_thread_task_runner.h"
13 #include "cc/trees/layer_tree_host_client.h"
14 #include "components/view_manager/public/interfaces/gpu.mojom.h"
15 #include "components/view_manager/public/interfaces/surfaces.mojom.h"
16 #include "mojo/cc/output_surface_mojo.h"
17 #include "third_party/WebKit/public/platform/WebLayerTreeView.h"
19 namespace base {
20 class MessageLoopProxy;
23 namespace blink {
24 class WebWidget;
27 namespace cc {
28 class LayerTreeHost;
31 namespace mojo {
32 class View;
35 namespace html_viewer {
37 class WebLayerTreeViewImpl : public blink::WebLayerTreeView,
38 public cc::LayerTreeHostClient,
39 public mojo::OutputSurfaceMojoClient {
40 public:
41 WebLayerTreeViewImpl(
42 scoped_refptr<base::MessageLoopProxy> compositor_message_loop_proxy,
43 mojo::SurfacePtr surface,
44 mojo::GpuPtr gpu_service);
45 ~WebLayerTreeViewImpl() override;
47 void set_widget(blink::WebWidget* widget) { widget_ = widget; }
48 void set_view(mojo::View* view) { view_ = view; }
50 // cc::LayerTreeHostClient implementation.
51 void WillBeginMainFrame() override;
52 void DidBeginMainFrame() override;
53 void BeginMainFrame(const cc::BeginFrameArgs& args) override;
54 void BeginMainFrameNotExpectedSoon() override;
55 void Layout() override;
56 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta,
57 const gfx::Vector2dF& outer_delta,
58 const gfx::Vector2dF& elastic_overscroll_delta,
59 float page_scale,
60 float top_controls_delta) override;
61 void ApplyViewportDeltas(const gfx::Vector2d& scroll_delta,
62 float page_scale,
63 float top_controls_delta) override;
64 void RequestNewOutputSurface() override;
65 void DidFailToInitializeOutputSurface() override;
66 void DidInitializeOutputSurface() override;
67 void WillCommit() override;
68 void DidCommit() override;
69 void DidCommitAndDrawFrame() override;
70 void DidCompleteSwapBuffers() override;
71 void DidCompletePageScaleAnimation() override {}
72 void RateLimitSharedMainThreadContext() override {}
74 // blink::WebLayerTreeView implementation.
75 virtual void setRootLayer(const blink::WebLayer& layer);
76 virtual void clearRootLayer();
77 virtual void setViewportSize(const blink::WebSize& device_viewport_size);
78 virtual blink::WebSize deviceViewportSize() const;
79 virtual void setDeviceScaleFactor(float);
80 virtual float deviceScaleFactor() const;
81 virtual void setBackgroundColor(blink::WebColor color);
82 virtual void setHasTransparentBackground(bool has_transparent_background);
83 virtual void setVisible(bool visible);
84 virtual void setPageScaleFactorAndLimits(float page_scale_factor,
85 float minimum,
86 float maximum);
87 virtual void startPageScaleAnimation(const blink::WebPoint& destination,
88 bool use_anchor,
89 float new_page_scale,
90 double duration_sec);
91 virtual void heuristicsForGpuRasterizationUpdated(bool matches_heuristic) {}
92 virtual void setNeedsAnimate();
93 virtual bool commitRequested() const;
94 virtual void didStopFlinging() {}
95 virtual void compositeAndReadbackAsync(
96 blink::WebCompositeAndReadbackAsyncCallback* callback) {}
97 virtual void finishAllRendering();
98 virtual void setDeferCommits(bool defer_commits) {}
99 virtual void registerForAnimations(blink::WebLayer* layer);
100 virtual void registerViewportLayers(
101 const blink::WebLayer* overscrollElasticityLayer,
102 const blink::WebLayer* pageScaleLayerLayer,
103 const blink::WebLayer* innerViewportScrollLayer,
104 const blink::WebLayer* outerViewportScrollLayer);
105 virtual void clearViewportLayers();
106 virtual void registerSelection(const blink::WebSelection& selection) {}
107 virtual void clearSelection() {}
108 virtual void setShowFPSCounter(bool) {}
109 virtual void setShowPaintRects(bool) {}
110 virtual void setShowDebugBorders(bool) {}
111 virtual void setContinuousPaintingEnabled(bool) {}
112 virtual void setShowScrollBottleneckRects(bool) {}
114 // OutputSurfaceMojoClient implementation.
115 void DidCreateSurface(cc::SurfaceId id) override;
117 private:
118 void DidCreateSurfaceOnMainThread(cc::SurfaceId id);
120 // widget_ and view_ will outlive us.
121 blink::WebWidget* widget_;
122 mojo::View* view_;
123 scoped_ptr<cc::LayerTreeHost> layer_tree_host_;
124 scoped_ptr<cc::OutputSurface> output_surface_;
125 scoped_refptr<base::SingleThreadTaskRunner>
126 main_thread_compositor_task_runner_;
127 base::WeakPtr<WebLayerTreeViewImpl> main_thread_bound_weak_ptr_;
129 base::WeakPtrFactory<WebLayerTreeViewImpl> weak_factory_;
130 DISALLOW_COPY_AND_ASSIGN(WebLayerTreeViewImpl);
133 } // namespace html_viewer
135 #endif // COMPONENTS_HTML_VIEWER_WEB_LAYER_TREE_VIEW_IMPL_H_