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

Unified Diff: mojo/edk/system/message_pipe_dispatcher_unittest.cc

Issue 1412283002: Convert mojo::system::Dispatcher to use our new refcounting stuff (instead of base's). (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: no change Created 5 years, 2 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/edk/system/message_pipe_dispatcher.cc ('k') | mojo/edk/system/multiprocess_message_pipe_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/message_pipe_dispatcher_unittest.cc
diff --git a/mojo/edk/system/message_pipe_dispatcher_unittest.cc b/mojo/edk/system/message_pipe_dispatcher_unittest.cc
index 8fd4696068ca9005dc37ef608b7bcbbdb3beb422..b51899b086b76e4cb71dc2e73b3d28a127596793 100644
--- a/mojo/edk/system/message_pipe_dispatcher_unittest.cc
+++ b/mojo/edk/system/message_pipe_dispatcher_unittest.cc
@@ -16,8 +16,8 @@
#include <utility>
#include <vector>
-#include "base/memory/ref_counted.h"
#include "mojo/edk/system/message_pipe.h"
+#include "mojo/edk/system/ref_ptr.h"
#include "mojo/edk/system/test_utils.h"
#include "mojo/edk/system/waiter.h"
#include "mojo/edk/system/waiter_test_utils.h"
@@ -42,10 +42,10 @@ TEST(MessagePipeDispatcherTest, Basic) {
// Run this test both with |d0| as port 0, |d1| as port 1 and vice versa.
for (unsigned i = 0; i < 2; i++) {
- scoped_refptr<MessagePipeDispatcher> d0 = MessagePipeDispatcher::Create(
+ auto d0 = MessagePipeDispatcher::Create(
MessagePipeDispatcher::kDefaultCreateOptions);
EXPECT_EQ(Dispatcher::Type::MESSAGE_PIPE, d0->GetType());
- scoped_refptr<MessagePipeDispatcher> d1 = MessagePipeDispatcher::Create(
+ auto d1 = MessagePipeDispatcher::Create(
MessagePipeDispatcher::kDefaultCreateOptions);
{
auto mp = MessagePipe::CreateLocalLocal();
@@ -154,9 +154,9 @@ TEST(MessagePipeDispatcherTest, Basic) {
TEST(MessagePipeDispatcherTest, InvalidParams) {
char buffer[1];
- scoped_refptr<MessagePipeDispatcher> d0 = MessagePipeDispatcher::Create(
+ auto d0 = MessagePipeDispatcher::Create(
MessagePipeDispatcher::kDefaultCreateOptions);
- scoped_refptr<MessagePipeDispatcher> d1 = MessagePipeDispatcher::Create(
+ auto d1 = MessagePipeDispatcher::Create(
MessagePipeDispatcher::kDefaultCreateOptions);
{
auto mp = MessagePipe::CreateLocalLocal();
@@ -184,9 +184,9 @@ TEST(MessagePipeDispatcherTest, InvalidParams) {
TEST(MessagePipeDispatcherTest, InvalidParamsDeath) {
const char kMemoryCheckFailedRegex[] = "Check failed";
- scoped_refptr<MessagePipeDispatcher> d0 = MessagePipeDispatcher::Create(
+ auto d0 = MessagePipeDispatcher::Create(
MessagePipeDispatcher::kDefaultCreateOptions);
- scoped_refptr<MessagePipeDispatcher> d1 = MessagePipeDispatcher::Create(
+ auto d1 = MessagePipeDispatcher::Create(
MessagePipeDispatcher::kDefaultCreateOptions);
{
auto mp = MessagePipe::CreateLocalLocal();
@@ -224,9 +224,9 @@ TEST(MessagePipeDispatcherTest, BasicClosed) {
// Run this test both with |d0| as port 0, |d1| as port 1 and vice versa.
for (unsigned i = 0; i < 2; i++) {
- scoped_refptr<MessagePipeDispatcher> d0 = MessagePipeDispatcher::Create(
+ auto d0 = MessagePipeDispatcher::Create(
MessagePipeDispatcher::kDefaultCreateOptions);
- scoped_refptr<MessagePipeDispatcher> d1 = MessagePipeDispatcher::Create(
+ auto d1 = MessagePipeDispatcher::Create(
MessagePipeDispatcher::kDefaultCreateOptions);
{
auto mp = MessagePipe::CreateLocalLocal();
@@ -354,9 +354,9 @@ TEST(MessagePipeDispatcherTest, BasicThreaded) {
// Run this test both with |d0| as port 0, |d1| as port 1 and vice versa.
for (unsigned i = 0; i < 2; i++) {
- scoped_refptr<MessagePipeDispatcher> d0 = MessagePipeDispatcher::Create(
+ auto d0 = MessagePipeDispatcher::Create(
MessagePipeDispatcher::kDefaultCreateOptions);
- scoped_refptr<MessagePipeDispatcher> d1 = MessagePipeDispatcher::Create(
+ auto d1 = MessagePipeDispatcher::Create(
MessagePipeDispatcher::kDefaultCreateOptions);
{
auto mp = MessagePipe::CreateLocalLocal();
@@ -437,9 +437,9 @@ TEST(MessagePipeDispatcherTest, BasicThreaded) {
}
for (unsigned i = 0; i < 2; i++) {
- scoped_refptr<MessagePipeDispatcher> d0 = MessagePipeDispatcher::Create(
+ auto d0 = MessagePipeDispatcher::Create(
MessagePipeDispatcher::kDefaultCreateOptions);
- scoped_refptr<MessagePipeDispatcher> d1 = MessagePipeDispatcher::Create(
+ auto d1 = MessagePipeDispatcher::Create(
MessagePipeDispatcher::kDefaultCreateOptions);
{
auto mp = MessagePipe::CreateLocalLocal();
@@ -479,7 +479,7 @@ class WriterThread : public mojo::test::SimpleTestThread {
public:
// |*messages_written| and |*bytes_written| belong to the thread while it's
// alive.
- WriterThread(scoped_refptr<Dispatcher> write_dispatcher,
+ WriterThread(RefPtr<Dispatcher> write_dispatcher,
size_t* messages_written,
size_t* bytes_written)
: write_dispatcher_(write_dispatcher),
@@ -518,7 +518,7 @@ class WriterThread : public mojo::test::SimpleTestThread {
MOJO_WRITE_MESSAGE_FLAG_NONE));
}
- const scoped_refptr<Dispatcher> write_dispatcher_;
+ const RefPtr<Dispatcher> write_dispatcher_;
size_t* const messages_written_;
size_t* const bytes_written_;
@@ -528,7 +528,7 @@ class WriterThread : public mojo::test::SimpleTestThread {
class ReaderThread : public mojo::test::SimpleTestThread {
public:
// |*messages_read| and |*bytes_read| belong to the thread while it's alive.
- ReaderThread(scoped_refptr<Dispatcher> read_dispatcher,
+ ReaderThread(RefPtr<Dispatcher> read_dispatcher,
size_t* messages_read,
size_t* bytes_read)
: read_dispatcher_(read_dispatcher),
@@ -604,7 +604,7 @@ class ReaderThread : public mojo::test::SimpleTestThread {
return true;
}
- const scoped_refptr<Dispatcher> read_dispatcher_;
+ const RefPtr<Dispatcher> read_dispatcher_;
size_t* const messages_read_;
size_t* const bytes_read_;
@@ -615,9 +615,9 @@ TEST(MessagePipeDispatcherTest, Stress) {
static const size_t kNumWriters = 30;
static const size_t kNumReaders = kNumWriters;
- scoped_refptr<MessagePipeDispatcher> d_write = MessagePipeDispatcher::Create(
+ auto d_write = MessagePipeDispatcher::Create(
MessagePipeDispatcher::kDefaultCreateOptions);
- scoped_refptr<MessagePipeDispatcher> d_read = MessagePipeDispatcher::Create(
+ auto d_read = MessagePipeDispatcher::Create(
MessagePipeDispatcher::kDefaultCreateOptions);
{
auto mp = MessagePipe::CreateLocalLocal();
« no previous file with comments | « mojo/edk/system/message_pipe_dispatcher.cc ('k') | mojo/edk/system/multiprocess_message_pipe_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698