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

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

Issue 2763753002: gpu: Add callback for yielding command buffer execution. (Closed)
Patch Set: no need to !!pause Created 3 years, 9 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 | « gpu/command_buffer/service/BUILD.gn ('k') | gpu/command_buffer/service/command_executor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/command_executor.h
diff --git a/gpu/command_buffer/service/command_executor.h b/gpu/command_buffer/service/command_executor.h
index 7493d4f6244cea0df0170dc5314b00a3c6093c31..6189c4b99a6aca6ffe5c48189f84bb60f9fe25b0 100644
--- a/gpu/command_buffer/service/command_executor.h
+++ b/gpu/command_buffer/service/command_executor.h
@@ -10,11 +10,8 @@
#include <memory>
#include <queue>
-#include "base/atomic_ref_count.h"
-#include "base/atomicops.h"
#include "base/callback.h"
#include "base/macros.h"
-#include "base/memory/ref_counted.h"
#include "base/memory/shared_memory.h"
#include "base/memory/weak_ptr.h"
#include "gpu/command_buffer/service/cmd_buffer_engine.h"
@@ -25,22 +22,6 @@
namespace gpu {
-class PreemptionFlag : public base::RefCountedThreadSafe<PreemptionFlag> {
- public:
- PreemptionFlag() : flag_(0) {}
-
- bool IsSet() { return !base::AtomicRefCountIsZero(&flag_); }
- void Set() { base::AtomicRefCountInc(&flag_); }
- void Reset() { base::subtle::NoBarrier_Store(&flag_, 0); }
-
- private:
- base::AtomicRefCount flag_;
-
- ~PreemptionFlag() {}
-
- friend class base::RefCountedThreadSafe<PreemptionFlag>;
-};
-
// This class schedules commands that have been flushed. They are received via
// a command buffer and forwarded to a command parser. TODO(apatrick): This
// class should not know about the decoder. Do not add additional dependencies
@@ -57,10 +38,6 @@ class GPU_EXPORT CommandExecutor
void PutChanged();
- void SetPreemptByFlag(scoped_refptr<PreemptionFlag> flag) {
- preemption_flag_ = flag;
- }
-
// Sets whether commands should be processed by this scheduler. Setting to
// false unschedules. Setting to true reschedules.
void SetScheduled(bool scheduled);
@@ -84,6 +61,9 @@ class GPU_EXPORT CommandExecutor
void SetCommandProcessedCallback(const base::Closure& callback);
+ using PauseExecutionCallback = base::Callback<bool(void)>;
+ void SetPauseExecutionCallback(const PauseExecutionCallback& callback);
+
// Returns whether the scheduler needs to be polled again in the future to
// process idle work.
bool HasMoreIdleWork() const;
@@ -99,7 +79,7 @@ class GPU_EXPORT CommandExecutor
CommandParser* parser() const { return parser_.get(); }
private:
- bool IsPreempted();
+ bool PauseExecution();
// The CommandExecutor holds a weak reference to the CommandBuffer. The
// CommandBuffer owns the CommandExecutor and holds a strong reference to it
@@ -120,13 +100,13 @@ class GPU_EXPORT CommandExecutor
std::unique_ptr<CommandParser> parser_;
// Whether the scheduler is currently able to process more commands.
- bool scheduled_;
+ bool scheduled_ = true;
base::Closure command_processed_callback_;
- // If non-NULL and |preemption_flag_->IsSet()|, exit PutChanged early.
- scoped_refptr<PreemptionFlag> preemption_flag_;
- bool was_preempted_;
+ // If this callback returns true, exit PutChanged early.
+ PauseExecutionCallback pause_execution_callback_;
+ bool paused_ = false;
DISALLOW_COPY_AND_ASSIGN(CommandExecutor);
};
« no previous file with comments | « gpu/command_buffer/service/BUILD.gn ('k') | gpu/command_buffer/service/command_executor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698