Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2466)

Unified Diff: blimp/client/compositor/blimp_compositor.h

Issue 1295243003: Initial commit of the blimp/ folder and target (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: blimp/client/compositor/blimp_compositor.h
diff --git a/blimp/client/compositor/blimp_compositor.h b/blimp/client/compositor/blimp_compositor.h
new file mode 100644
index 0000000000000000000000000000000000000000..dbb7cf5953f7187604aebfff5548b6eb0f34f730
--- /dev/null
+++ b/blimp/client/compositor/blimp_compositor.h
@@ -0,0 +1,101 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BLIMP_CLIENT_COMPOSITOR_BLIMP_COMPOSITOR_H_
+#define BLIMP_CLIENT_COMPOSITOR_BLIMP_COMPOSITOR_H_
+
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "cc/trees/layer_tree_host_client.h"
+#include "cc/trees/layer_tree_host_single_thread_client.h"
+#include "cc/trees/layer_tree_settings.h"
+#include "ui/gfx/geometry/size.h"
+#include "ui/gfx/native_widget_types.h"
+
+namespace base {
+class CommandLine;
+class SingleThreadTaskRunner;
+class Thread;
+}
+
+namespace cc {
+class LayerTreeHost;
+}
+
+namespace blimp {
+
+// BlimpCompositor provides the basic framework and setup to host a
+// LayerTreeHost (compositor). The rendering surface this compositor draws to
+// is defined by the gfx::AcceleratedWidget returned by
+// BlimpCompositor::GetWindow().
+class BlimpCompositor : public cc::LayerTreeHostClient,
+ public cc::LayerTreeHostSingleThreadClient {
+ public:
+ ~BlimpCompositor() override;
+
+ void SetVisible(bool visible);
+ void SetSize(const gfx::Size& size);
+
+ // LayerTreeHostClient Implementation ----------------------------------------
+ void WillBeginMainFrame() override {}
+ void DidBeginMainFrame() override {}
+ void BeginMainFrame(const cc::BeginFrameArgs& args) override {}
+ void BeginMainFrameNotExpectedSoon() override {}
+ void Layout() override;
+ void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta,
+ const gfx::Vector2dF& outer_delta,
+ const gfx::Vector2dF& elastic_overscroll_delta,
+ float page_scale,
+ float top_controls_delta) override {}
+ void RequestNewOutputSurface() override;
+ void DidInitializeOutputSurface() override;
+ void DidFailToInitializeOutputSurface() override;
+ void WillCommit() override {}
+ void DidCommit() override;
+ void DidCommitAndDrawFrame() override {}
+ void DidCompleteSwapBuffers() override;
+ void DidCompletePageScaleAnimation() override {}
+ void RecordFrameTimingEvents(
+ scoped_ptr<cc::FrameTimingTracker::CompositeTimingSet> composite_events,
+ scoped_ptr<cc::FrameTimingTracker::MainFrameTimingSet> main_frame_events)
+ override {}
+
+ // LayerTreeHostSingleThreadClient Implementation ----------------------------
+ void ScheduleComposite() override;
+ void ScheduleAnimation() override;
+ void DidPostSwapBuffers() override;
+ void DidAbortSwapBuffers() override;
+
+ protected:
+ explicit BlimpCompositor(float device_scale_factor);
+
+ // Used by this class when building the OutputSurface that this compositor
+ // draws to. This needs to return a valid gfx::AcceleratedWidget by the time
+ // BlimpCompositor::SetVisible(true) is called.
+ virtual gfx::AcceleratedWidget GetWindow() = 0;
+
+ // Populates the cc::LayerTreeSettings used by the cc::LayerTreeHost. Can be
+ // overridden to provide custom settings parameters.
+ virtual void GenerateLayerTreeSettings(cc::LayerTreeSettings* settings,
+ const base::CommandLine& cmd);
+
+ private:
+ scoped_refptr<base::SingleThreadTaskRunner> GetCompositorTaskRunner();
+
+ gfx::Size viewport_size_;
+ float device_scale_factor_;
+ scoped_ptr<cc::LayerTreeHost> host_;
+ scoped_ptr<cc::LayerTreeSettings> settings_;
+ scoped_ptr<base::Thread> compositor_thread_;
+
+ base::WeakPtrFactory<BlimpCompositor> weak_factory_;
Wez 2015/08/27 18:23:54 This seems to be unused.
David Trainor- moved to gerrit 2015/08/28 01:23:47 Gah thanks! Forgot to take it out.
+
+ DISALLOW_COPY_AND_ASSIGN(BlimpCompositor);
+};
+
+} // namespace blimp
+
+#endif // BLIMP_CLIENT_COMPOSITOR_BLIMP_COMPOSITOR_H_

Powered by Google App Engine
This is Rietveld 408576698