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

Unified Diff: blimp/client/android/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/android/compositor/blimp_compositor.h
diff --git a/blimp/client/android/compositor/blimp_compositor.h b/blimp/client/android/compositor/blimp_compositor.h
new file mode 100644
index 0000000000000000000000000000000000000000..0ad9c29a85697801e5d5be953d6823816d380150
--- /dev/null
+++ b/blimp/client/android/compositor/blimp_compositor.h
@@ -0,0 +1,96 @@
+// 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_ANDROID_COMPOSITOR_BLIMP_COMPOSITOR_H_
+#define BLIMP_CLIENT_ANDROID_COMPOSITOR_BLIMP_COMPOSITOR_H_
+
+#include "base/android/jni_android.h"
+#include "base/macros.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"
+
+struct ANativeWindow;
+
+namespace base {
+class SingleThreadTaskRunner;
+class Thread;
+}
+
+namespace cc {
+class LayerTreeHost;
+}
+
+namespace blimp {
+
+class BlimpCompositor : public cc::LayerTreeHostClient,
nyquist 2015/08/19 07:48:06 Nit: A little class comment might be helpful here.
David Trainor- moved to gerrit 2015/08/21 00:49:46 Done.
+ public cc::LayerTreeHostSingleThreadClient {
+ public:
+ static scoped_ptr<BlimpCompositor> Create(const gfx::Size& physical_size,
+ const gfx::Size& display_size,
+ float device_scale_factor);
+
+ ~BlimpCompositor() override;
+
+ void SetSurface(JNIEnv* env, jobject jsurface);
nyquist 2015/08/19 07:48:06 Like you mentioned yourself, it'd be great to have
David Trainor- moved to gerrit 2015/08/21 00:49:46 Done.
+ 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:
+ BlimpCompositor(const gfx::Size& physical_size,
+ const gfx::Size& display_size,
+ float device_scale_factor);
+
+ private:
+ scoped_refptr<base::SingleThreadTaskRunner> GetCompositorTaskRunner();
+
+ gfx::Size viewport_size_;
+ float device_scale_factor_;
+
+ cc::LayerTreeSettings settings_;
+
+ ANativeWindow* window_;
+ scoped_ptr<cc::LayerTreeHost> host_;
+ scoped_ptr<base::Thread> compositor_thread_;
+
+ base::WeakPtrFactory<BlimpCompositor> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(BlimpCompositor);
+};
+
+} // namespace blimp
+
+#endif // BLIMP_CLIENT_ANDROID_COMPOSITOR_BLIMP_COMPOSITOR_H_

Powered by Google App Engine
This is Rietveld 408576698