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

Unified Diff: cc/surfaces/in_process_context_provider.h

Issue 2498053004: Add InProcessContextProvider and update InProcessCommandBuffer (Closed)
Patch Set: Created 4 years, 1 month 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: cc/surfaces/in_process_context_provider.h
diff --git a/cc/surfaces/in_process_context_provider.h b/cc/surfaces/in_process_context_provider.h
new file mode 100644
index 0000000000000000000000000000000000000000..3fe1f8febe066bf9f2c19dab7a00785a41e20c34
--- /dev/null
+++ b/cc/surfaces/in_process_context_provider.h
@@ -0,0 +1,85 @@
+// 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 CC_SURFACES_IN_PROCESS_CONTEXT_PROVIDER_H_
+#define CC_SURFACES_IN_PROCESS_CONTEXT_PROVIDER_H_
+
+#include <stdint.h>
+
+#include <memory>
+
+#include "base/synchronization/lock.h"
+#include "cc/output/context_cache_controller.h"
+#include "cc/output/context_provider.h"
+#include "gpu/command_buffer/common/gles2_cmd_utils.h"
+#include "gpu/ipc/in_process_command_buffer.h"
+#include "ui/gfx/native_widget_types.h"
+
+class GrContext;
+
+namespace gpu {
+class GLInProcessContext;
+class GpuMemoryBufferManager;
+class ImageFactory;
+struct SharedMemoryLimits;
+class SyncPointManager;
+namespace gles2 {
+class MailboxManager;
+}
+}
+
+namespace skia_bindings {
+class GrContextForGLES2Interface;
+}
+
+namespace cc {
+
+class InProcessContextProvider : public ContextProvider {
+ public:
+ InProcessContextProvider(
+ scoped_refptr<gpu::InProcessCommandBuffer::Service> service,
+ gfx::AcceleratedWidget widget,
+ gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
+ gpu::ImageFactory* image_factory,
+ const gpu::SharedMemoryLimits& limits,
+ InProcessContextProvider* shared_context);
+
+ bool BindToCurrentThread() override;
+ gpu::gles2::GLES2Interface* ContextGL() override;
+ gpu::ContextSupport* ContextSupport() override;
+ class GrContext* GrContext() override;
+ ContextCacheController* CacheController() override;
+ void InvalidateGrContext(uint32_t state) override;
+ base::Lock* GetLock() override;
+ gpu::Capabilities ContextCapabilities() override;
+ // void DeleteCachedResources() override;
+ void SetLostContextCallback(
+ const LostContextCallback& lost_context_callback) override;
+
+ uint32_t GetCopyTextureInternalFormat();
+
+ void SetSwapBuffersCompletionCallback(
+ const gpu::InProcessCommandBuffer::SwapBuffersCompletionCallback&
+ callback);
+
+ void SetUpdateVSyncParametersCallback(
+ const gpu::InProcessCommandBuffer::UpdateVSyncParametersCallback&
+ callback);
+
+ protected:
+ friend class base::RefCountedThreadSafe<InProcessContextProvider>;
+ ~InProcessContextProvider() override;
+
+ private:
+ const gpu::gles2::ContextCreationAttribHelper attributes_;
+
+ base::Lock context_lock_;
+ std::unique_ptr<gpu::GLInProcessContext> context_;
+ std::unique_ptr<skia_bindings::GrContextForGLES2Interface> gr_context_;
+ std::unique_ptr<ContextCacheController> cache_controller_;
+};
+
+} // namespace cc
+
+#endif // CC_SURFACES_IN_PROCESS_CONTEXT_PROVIDER_H_

Powered by Google App Engine
This is Rietveld 408576698