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

Unified Diff: chrome/browser/android/blimp/chrome_compositor_dependencies.h

Issue 2297933002: blimp: Set up the CompositorDependencies for blimp in Chrome. (Closed)
Patch Set: Created 4 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: chrome/browser/android/blimp/chrome_compositor_dependencies.h
diff --git a/chrome/browser/android/blimp/chrome_compositor_dependencies.h b/chrome/browser/android/blimp/chrome_compositor_dependencies.h
new file mode 100644
index 0000000000000000000000000000000000000000..ef6a58e3f98fdcafca8a243a73bf9fdcd1429251
--- /dev/null
+++ b/chrome/browser/android/blimp/chrome_compositor_dependencies.h
@@ -0,0 +1,55 @@
+// Copyright 2016 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 CHROME_BROWSER_ANDROID_BLIMP_CHROME_COMPOSITOR_DEPENDENCIES_H_
+#define CHROME_BROWSER_ANDROID_BLIMP_CHROME_COMPOSITOR_DEPENDENCIES_H_
+
+#include <list>
+
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "blimp/client/public/compositor/compositor_dependencies.h"
+
+namespace ui {
+class ContextProviderFactory;
+} // namespace ui
+
+// A wrapper for the Blimp compositor dependencies that passes through to the
+// ui::ContextProviderFactory. The ContextProviderFactory must outlive this
+// class.
+class ChromeCompositorDependencies
+ : public blimp::client::CompositorDependencies {
+ public:
+ ChromeCompositorDependencies(
+ ui::ContextProviderFactory* context_provider_factory);
+ ~ChromeCompositorDependencies() override;
+
+ // CompositorDependencies implementation.
+ cc::LayerTreeSettings* GetLayerTreeSettings() override;
+ gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override;
+ cc::SurfaceManager* GetSurfaceManager() override;
+ uint32_t AllocateSurfaceClientId() override;
+ void GetContextProviders(const ContextProviderCallback& callback) override;
+
+ private:
+ void OnWorkerContextCreated(
+ const scoped_refptr<cc::ContextProvider>& worker_context);
+
+ void HandleCompositorContextRequest(const ContextProviderCallback& callback);
+
+ ui::ContextProviderFactory* context_provider_factory_;
+
+ bool worker_context_request_pending_;
David Trainor- moved to gerrit 2016/08/31 00:28:58 Add some comments around why we're doing it this w
Khushal 2016/08/31 21:22:51 Done.
+
+ // Worker context shared across all Blimp Compositors.
+ scoped_refptr<cc::ContextProvider> shared_main_thread_worker_context_;
+
+ std::list<ContextProviderCallback> pending_requests_;
+
+ base::WeakPtrFactory<ChromeCompositorDependencies> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(ChromeCompositorDependencies);
+};
+
+#endif // CHROME_BROWSER_ANDROID_BLIMP_CHROME_COMPOSITOR_DEPENDENCIES_H_

Powered by Google App Engine
This is Rietveld 408576698