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

Unified Diff: components/view_manager/surfaces/command_buffer_local.h

Issue 1245683004: Mandoline: Merge Surfaces and Views apps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Rob's comments 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: components/view_manager/surfaces/command_buffer_local.h
diff --git a/components/view_manager/surfaces/command_buffer_local.h b/components/view_manager/surfaces/command_buffer_local.h
new file mode 100644
index 0000000000000000000000000000000000000000..cc1385e3647cab851e18e6a58950a3ff2ec18e4f
--- /dev/null
+++ b/components/view_manager/surfaces/command_buffer_local.h
@@ -0,0 +1,110 @@
+// 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 COMPONENTS_VIEW_MANAGER_SURFACES_COMMAND_LOCAL_H_
+#define COMPONENTS_VIEW_MANAGER_SURFACES_COMMAND_LOCAL_H_
+
+#include <map>
+
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "components/view_manager/gles2/gpu_state.h"
+#include "gpu/command_buffer/client/gpu_control.h"
+#include "gpu/command_buffer/common/command_buffer.h"
+#include "gpu/command_buffer/common/command_buffer_shared.h"
+#include "gpu/command_buffer/service/command_buffer_service.h"
+#include "ui/gfx/geometry/size.h"
+#include "ui/gfx/gpu_memory_buffer.h"
+#include "ui/gfx/native_widget_types.h"
+
+namespace gpu {
+class CommandBufferService;
+class GpuScheduler;
+class GpuControlService;
+namespace gles2 {
+class GLES2Decoder;
+}
+}
+
+namespace gfx {
+class GLContext;
+class GLSurface;
+}
+
+namespace surfaces {
+
+// This class provides a thin wrapper around a CommandBufferService and a
rjkroege 2015/08/06 22:39:11 I think that you have an extra copy of everything.
Fady Samuel 2015/08/07 01:15:21 Extra copy? Possibly... I don't know the innards o
+// GpuControl implementation to allow cc::Display to generate GL directly on
+// the same thread.
+class CommandBufferLocal : public gpu::GpuControl {
+ public:
+ class Client {
+ public:
+ virtual ~Client() {}
+ virtual void UpdateVSyncParameters(int64_t timebase, int64_t interval) = 0;
+ virtual void DidLoseContext() = 0;
+ };
+
+ CommandBufferLocal(Client* client,
+ gfx::AcceleratedWidget widget,
+ const scoped_refptr<gles2::GpuState>& gpu_state);
+ ~CommandBufferLocal() override;
+
+ bool Initialize();
+
+ gpu::CommandBuffer* command_buffer() { return command_buffer_.get(); }
+
+ // gpu::GpuControl implementation:
+ gpu::Capabilities GetCapabilities() override;
+ int32_t CreateImage(ClientBuffer buffer,
+ size_t width,
+ size_t height,
+ unsigned internalformat) override;
+ void DestroyImage(int32_t id) override;
+ int32_t CreateGpuMemoryBufferImage(size_t width,
+ size_t height,
+ unsigned internalformat,
+ unsigned usage) override;
+ uint32 InsertSyncPoint() override;
+ uint32 InsertFutureSyncPoint() override;
+ void RetireSyncPoint(uint32 sync_point) override;
+ void SignalSyncPoint(uint32 sync_point,
+ const base::Closure& callback) override;
+ void SignalQuery(uint32 query, const base::Closure& callback) override;
+ void SetSurfaceVisible(bool visible) override;
+ uint32 CreateStreamTexture(uint32 texture_id) override;
+ void SetLock(base::Lock*) override;
+ bool IsGpuChannelLost() override;
+
+ private:
+ void PumpCommands();
+ static scoped_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBuffer(
+ const gfx::Size& size,
+ gfx::BufferFormat format);
+
+ void OnResize(gfx::Size size, float scale_factor);
+ void OnUpdateVSyncParameters(const base::TimeTicks timebase,
+ const base::TimeDelta interval);
+ bool OnWaitSyncPoint(uint32_t sync_point);
+ void OnParseError();
+ void OnContextLost(uint32_t reason);
+ void OnSyncPointRetired();
+
+ gfx::AcceleratedWidget widget_;
+ scoped_refptr<gles2::GpuState> gpu_state_;
+ scoped_ptr<gpu::CommandBufferService> command_buffer_;
+ scoped_ptr<gpu::GpuScheduler> scheduler_;
+ scoped_ptr<gpu::gles2::GLES2Decoder> decoder_;
+ scoped_refptr<gfx::GLContext> context_;
+ scoped_refptr<gfx::GLSurface> surface_;
+ Client* client_;
+
+ base::WeakPtrFactory<CommandBufferLocal> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(CommandBufferLocal);
+};
+
+} // namespace surfaces
+
+#endif // COMPONENTS_VIEW_MANAGER_SURFACES_COMMAND_BUFFER_LOCAL_H_

Powered by Google App Engine
This is Rietveld 408576698