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

Unified Diff: services/ui/gles2/command_buffer_impl.h

Issue 2194893002: services/ui: Revert CLs that broke Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 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
« no previous file with comments | « services/ui/gles2/command_buffer_driver_manager.cc ('k') | services/ui/gles2/command_buffer_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/gles2/command_buffer_impl.h
diff --git a/services/ui/gles2/command_buffer_impl.h b/services/ui/gles2/command_buffer_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..076e92f1d356ef60f6bb5a5771ad258f7f593a8b
--- /dev/null
+++ b/services/ui/gles2/command_buffer_impl.h
@@ -0,0 +1,126 @@
+// Copyright 2014 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 SERVICES_UI_GLES2_COMMAND_BUFFER_IMPL_H_
+#define SERVICES_UI_GLES2_COMMAND_BUFFER_IMPL_H_
+
+#include <stdint.h>
+
+#include <memory>
+
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "base/single_thread_task_runner.h"
+#include "gpu/command_buffer/common/command_buffer.h"
+#include "mojo/public/cpp/bindings/binding.h"
+#include "services/ui/gles2/command_buffer_driver.h"
+#include "services/ui/public/interfaces/command_buffer.mojom.h"
+
+namespace ui {
+
+class CommandBufferDriver;
+class GpuState;
+
+// This class listens to the CommandBuffer message pipe on a low-latency thread
+// so that we can insert sync points without blocking on the GL driver. It
+// forwards most method calls to the CommandBufferDriver, which runs on the
+// same thread as the native viewport.
+class CommandBufferImpl : public mojom::CommandBuffer,
+ public CommandBufferDriver::Client {
+ public:
+ CommandBufferImpl(mojo::InterfaceRequest<CommandBuffer> request,
+ scoped_refptr<GpuState> gpu_state);
+
+ private:
+ class CommandBufferDriverClientImpl;
+ ~CommandBufferImpl() override;
+
+ // CommandBufferDriver::Client. All called on the GPU thread.
+ void DidLoseContext(uint32_t reason) override;
+ void UpdateVSyncParameters(const base::TimeTicks& timebase,
+ const base::TimeDelta& interval) override;
+ void OnGpuCompletedSwapBuffers(gfx::SwapResult result) override;
+
+ // mojom::CommandBuffer:
+ void Initialize(
+ mojom::CommandBufferClientPtr client,
+ mojo::ScopedSharedBufferHandle shared_state,
+ mojo::Array<int32_t> attribs,
+ const mojom::CommandBuffer::InitializeCallback& callback) override;
+ void SetGetBuffer(int32_t buffer) override;
+ void Flush(int32_t put_offset) override;
+ void MakeProgress(
+ int32_t last_get_offset,
+ const mojom::CommandBuffer::MakeProgressCallback& callback) override;
+ void RegisterTransferBuffer(int32_t id,
+ mojo::ScopedSharedBufferHandle transfer_buffer,
+ uint32_t size) override;
+ void DestroyTransferBuffer(int32_t id) override;
+ void CreateImage(int32_t id,
+ mojo::ScopedHandle memory_handle,
+ int32_t type,
+ const gfx::Size& size,
+ int32_t format,
+ int32_t internal_format) override;
+ void DestroyImage(int32_t id) override;
+ void CreateStreamTexture(
+ uint32_t client_texture_id,
+ const mojom::CommandBuffer::CreateStreamTextureCallback& callback
+ ) override;
+ void TakeFrontBuffer(const gpu::Mailbox& mailbox) override;
+ void ReturnFrontBuffer(const gpu::Mailbox& mailbox, bool is_lost) override;
+ void SignalQuery(uint32_t query, uint32_t signal_id) override;
+ void SignalSyncToken(const gpu::SyncToken& sync_token,
+ uint32_t signal_id) override;
+ void WaitForGetOffsetInRange(
+ int32_t start, int32_t end,
+ const mojom::CommandBuffer::WaitForGetOffsetInRangeCallback& callback
+ ) override;
+ void WaitForTokenInRange(
+ int32_t start, int32_t end,
+ const mojom::CommandBuffer::WaitForGetOffsetInRangeCallback& callback
+ ) override;
+
+ // All helper functions are called in the GPU therad.
+ void InitializeOnGpuThread(
+ mojom::CommandBufferClientPtr client,
+ mojo::ScopedSharedBufferHandle shared_state,
+ mojo::Array<int32_t> attribs,
+ const base::Callback<
+ void(mojom::CommandBufferInitializeResultPtr)>& callback);
+ bool SetGetBufferOnGpuThread(int32_t buffer);
+ bool FlushOnGpuThread(int32_t put_offset, uint32_t order_num);
+ bool MakeProgressOnGpuThread(
+ int32_t last_get_offset,
+ const base::Callback<void(const gpu::CommandBuffer::State&)>& callback);
+ bool RegisterTransferBufferOnGpuThread(
+ int32_t id,
+ mojo::ScopedSharedBufferHandle transfer_buffer,
+ uint32_t size);
+ bool DestroyTransferBufferOnGpuThread(int32_t id);
+ bool CreateImageOnGpuThread(int32_t id,
+ mojo::ScopedHandle memory_handle,
+ int32_t type,
+ const gfx::Size& size,
+ int32_t format,
+ int32_t internal_format);
+ bool DestroyImageOnGpuThread(int32_t id);
+
+ void BindToRequest(mojo::InterfaceRequest<CommandBuffer> request);
+
+ void OnConnectionError();
+ bool DeleteOnGpuThread();
+ void DeleteOnGpuThread2();
+
+ scoped_refptr<GpuState> gpu_state_;
+ std::unique_ptr<CommandBufferDriver> driver_;
+ std::unique_ptr<mojo::Binding<CommandBuffer>> binding_;
+ mojom::CommandBufferClientPtr client_;
+
+ DISALLOW_COPY_AND_ASSIGN(CommandBufferImpl);
+};
+
+} // namespace ui
+
+#endif // SERVICES_UI_GLES2_COMMAND_BUFFER_IMPL_H_
« no previous file with comments | « services/ui/gles2/command_buffer_driver_manager.cc ('k') | services/ui/gles2/command_buffer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698