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

Unified Diff: mojo/public/cpp/bindings/connector.h

Issue 2608163003: Change single-interface mojo bindings to use SequencedTaskRunner. (Closed)
Patch Set: Created 3 years, 11 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 | « mojo/public/cpp/bindings/binding.h ('k') | mojo/public/cpp/bindings/interface_endpoint_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/connector.h
diff --git a/mojo/public/cpp/bindings/connector.h b/mojo/public/cpp/bindings/connector.h
index 1ccc79586b0eea0a152b282cd598b00e1f432c50..159dd2b634302b70561ae874514882498e86c5fb 100644
--- a/mojo/public/cpp/bindings/connector.h
+++ b/mojo/public/cpp/bindings/connector.h
@@ -11,8 +11,8 @@
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "base/single_thread_task_runner.h"
-#include "base/threading/thread_checker.h"
+#include "base/sequence_checker.h"
+#include "base/sequenced_task_runner.h"
#include "mojo/public/cpp/bindings/bindings_export.h"
#include "mojo/public/cpp/bindings/message.h"
#include "mojo/public/cpp/bindings/sync_handle_watcher.h"
@@ -48,14 +48,14 @@ class MOJO_CPP_BINDINGS_EXPORT Connector
// The Connector takes ownership of |message_pipe|.
Connector(ScopedMessagePipeHandle message_pipe,
ConnectorConfig config,
- scoped_refptr<base::SingleThreadTaskRunner> runner);
+ scoped_refptr<base::SequencedTaskRunner> runner);
~Connector() override;
// Sets the receiver to handle messages read from the message pipe. The
// Connector will read messages from the pipe regardless of whether or not an
// incoming receiver has been set.
void set_incoming_receiver(MessageReceiver* receiver) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK(sequence_checker_.CalledOnValidSequence());
incoming_receiver_ = receiver;
}
@@ -63,21 +63,21 @@ class MOJO_CPP_BINDINGS_EXPORT Connector
// state, where no more messages will be processed. This method is used
// during testing to prevent that from happening.
void set_enforce_errors_from_incoming_receiver(bool enforce) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK(sequence_checker_.CalledOnValidSequence());
enforce_errors_from_incoming_receiver_ = enforce;
}
// Sets the error handler to receive notifications when an error is
// encountered while reading from the pipe or waiting to read from the pipe.
void set_connection_error_handler(const base::Closure& error_handler) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK(sequence_checker_.CalledOnValidSequence());
connection_error_handler_ = error_handler;
}
// Returns true if an error was encountered while reading from the pipe or
// waiting to read from the pipe.
bool encountered_error() const {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK(sequence_checker_.CalledOnValidSequence());
return error_;
}
@@ -105,7 +105,7 @@ class MOJO_CPP_BINDINGS_EXPORT Connector
// Is the connector bound to a MessagePipe handle?
bool is_valid() const {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK(sequence_checker_.CalledOnValidSequence());
return message_pipe_.is_valid();
}
@@ -122,7 +122,7 @@ class MOJO_CPP_BINDINGS_EXPORT Connector
bool Accept(Message* message) override;
MessagePipeHandle handle() const {
- DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK(sequence_checker_.CalledOnValidSequence());
return message_pipe_.get();
}
@@ -146,9 +146,7 @@ class MOJO_CPP_BINDINGS_EXPORT Connector
return sync_handle_watcher_callback_count_ > 0;
}
- base::SingleThreadTaskRunner* task_runner() const {
- return task_runner_.get();
- }
+ base::SequencedTaskRunner* task_runner() const { return task_runner_.get(); }
// Sets the tag used by the heap profiler.
// |tag| must be a const string literal.
@@ -186,7 +184,7 @@ class MOJO_CPP_BINDINGS_EXPORT Connector
ScopedMessagePipeHandle message_pipe_;
MessageReceiver* incoming_receiver_ = nullptr;
- scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
+ scoped_refptr<base::SequencedTaskRunner> task_runner_;
std::unique_ptr<Watcher> handle_watcher_;
bool error_ = false;
@@ -205,7 +203,7 @@ class MOJO_CPP_BINDINGS_EXPORT Connector
// callback.
size_t sync_handle_watcher_callback_count_ = 0;
- base::ThreadChecker thread_checker_;
+ base::SequenceChecker sequence_checker_;
base::Lock connected_lock_;
bool connected_ = true;
« no previous file with comments | « mojo/public/cpp/bindings/binding.h ('k') | mojo/public/cpp/bindings/interface_endpoint_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698