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

Unified Diff: gpu/command_buffer/service/in_process_command_buffer.h

Issue 1864723003: Make lost context and error message callbacks on GpuControl go to client (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: errorcallback: blimp Created 4 years, 8 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: gpu/command_buffer/service/in_process_command_buffer.h
diff --git a/gpu/command_buffer/service/in_process_command_buffer.h b/gpu/command_buffer/service/in_process_command_buffer.h
index 731c4868f54db8cffe571b1cd3c96f30a43a4037..742170bc555454e0cc04a32cab3cc9f3e857f043 100644
--- a/gpu/command_buffer/service/in_process_command_buffer.h
+++ b/gpu/command_buffer/service/in_process_command_buffer.h
@@ -19,6 +19,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
+#include "base/single_thread_task_runner.h"
#include "base/synchronization/lock.h"
#include "base/synchronization/waitable_event.h"
#include "base/threading/thread.h"
@@ -92,7 +93,6 @@ class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer,
const gfx::Size& size,
const std::vector<int32_t>& attribs,
gfx::GpuPreference gpu_preference,
- const base::Closure& context_lost_callback,
InProcessCommandBuffer* share_group,
GpuMemoryBufferManager* gpu_memory_buffer_manager,
ImageFactory* image_factory);
@@ -113,6 +113,8 @@ class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer,
gpu::error::Error GetLastError() override;
// GpuControl implementation:
+ // NOTE: The GpuControlClient will be called on the GPU thread.
no sievers 2016/04/07 21:07:58 on the client thread, right?
danakj 2016/04/07 21:45:18 Yep that was fixed. Comment fixed too now.
+ void SetGpuControlClient(GpuControlClient*) override;
gpu::Capabilities GetCapabilities() override;
int32_t CreateImage(ClientBuffer buffer,
size_t width,
@@ -239,16 +241,19 @@ class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer,
void DestroyImageOnGpuThread(int32_t id);
void SetGetBufferOnGpuThread(int32_t shm_id, base::WaitableEvent* completion);
- // Callbacks:
+ // Callbacks on the gpu thread.
+ void OnContextLostOnGpuThread();
+ void PumpCommandsOnGpuThread();
+ void PerformDelayedWorkOnGpuThread();
+ // Callback implementations on the client thread.
void OnContextLost();
- bool GetBufferChanged(int32_t transfer_buffer_id);
- void PumpCommands();
- void PerformDelayedWork();
const CommandBufferId command_buffer_id_;
// Members accessed on the gpu thread (possibly with the exception of
// creation):
+ scoped_refptr<base::SingleThreadTaskRunner> origin_task_runner_;
+ GpuControlClient* gpu_control_client_;
bool context_lost_;
scoped_refptr<TransferBufferManagerInterface> transfer_buffer_manager_;
scoped_ptr<CommandExecutor> executor_;
@@ -258,7 +263,8 @@ class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer,
scoped_refptr<SyncPointOrderData> sync_point_order_data_;
scoped_ptr<SyncPointClient> sync_point_client_;
base::Closure context_lost_callback_;
- bool delayed_work_pending_; // Used to throttle PerformDelayedWork.
+ // Used to throttle PerformDelayedWorkOnGpuThread.
+ bool delayed_work_pending_;
ImageFactory* image_factory_;
// Members accessed on the client thread:
@@ -288,7 +294,9 @@ class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer,
// the client thread.
scoped_ptr<base::SequenceChecker> sequence_checker_;
+ base::WeakPtr<InProcessCommandBuffer> client_thread_weak_ptr_;
base::WeakPtr<InProcessCommandBuffer> gpu_thread_weak_ptr_;
+ base::WeakPtrFactory<InProcessCommandBuffer> client_thread_weak_ptr_factory_;
base::WeakPtrFactory<InProcessCommandBuffer> gpu_thread_weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(InProcessCommandBuffer);

Powered by Google App Engine
This is Rietveld 408576698