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

Side by Side Diff: mojo/edk/embedder/embedder.cc

Issue 902783004: Add more unnecessary .Pass()s for MSVS. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/edk/embedder/embedder.h" 5 #include "mojo/edk/embedder/embedder.h"
6 6
7 #include "base/atomicops.h" 7 #include "base/atomicops.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 DCHECK(channel_info); 108 DCHECK(channel_info);
109 109
110 *channel_info = new ChannelInfo(MakeChannelId()); 110 *channel_info = new ChannelInfo(MakeChannelId());
111 scoped_refptr<system::MessagePipeDispatcher> dispatcher = 111 scoped_refptr<system::MessagePipeDispatcher> dispatcher =
112 internal::g_channel_manager->CreateChannelOnIOThread( 112 internal::g_channel_manager->CreateChannelOnIOThread(
113 (*channel_info)->channel_id, platform_handle.Pass()); 113 (*channel_info)->channel_id, platform_handle.Pass());
114 114
115 ScopedMessagePipeHandle rv( 115 ScopedMessagePipeHandle rv(
116 MessagePipeHandle(internal::g_core->AddDispatcher(dispatcher))); 116 MessagePipeHandle(internal::g_core->AddDispatcher(dispatcher)));
117 CHECK(rv.is_valid()); 117 CHECK(rv.is_valid());
118 return rv; 118 // TODO(vtl): The |.Pass()| below is only needed due to an MSVS bug; remove it
119 // once that's fixed.
120 return rv.Pass();
119 } 121 }
120 122
121 ScopedMessagePipeHandle CreateChannel( 123 ScopedMessagePipeHandle CreateChannel(
122 ScopedPlatformHandle platform_handle, 124 ScopedPlatformHandle platform_handle,
123 scoped_refptr<base::TaskRunner> io_thread_task_runner, 125 scoped_refptr<base::TaskRunner> io_thread_task_runner,
124 DidCreateChannelCallback callback, 126 DidCreateChannelCallback callback,
125 scoped_refptr<base::TaskRunner> callback_thread_task_runner) { 127 scoped_refptr<base::TaskRunner> callback_thread_task_runner) {
126 DCHECK(platform_handle.is_valid()); 128 DCHECK(platform_handle.is_valid());
127 DCHECK(io_thread_task_runner); 129 DCHECK(io_thread_task_runner);
128 DCHECK(!callback.is_null()); 130 DCHECK(!callback.is_null());
129 131
130 system::ChannelId channel_id = MakeChannelId(); 132 system::ChannelId channel_id = MakeChannelId();
131 scoped_ptr<ChannelInfo> channel_info(new ChannelInfo(channel_id)); 133 scoped_ptr<ChannelInfo> channel_info(new ChannelInfo(channel_id));
132 scoped_refptr<system::MessagePipeDispatcher> dispatcher = 134 scoped_refptr<system::MessagePipeDispatcher> dispatcher =
133 internal::g_channel_manager->CreateChannel( 135 internal::g_channel_manager->CreateChannel(
134 channel_id, platform_handle.Pass(), io_thread_task_runner, 136 channel_id, platform_handle.Pass(), io_thread_task_runner,
135 base::Bind(callback, base::Unretained(channel_info.release())), 137 base::Bind(callback, base::Unretained(channel_info.release())),
136 callback_thread_task_runner); 138 callback_thread_task_runner);
137 139
138 ScopedMessagePipeHandle rv( 140 ScopedMessagePipeHandle rv(
139 MessagePipeHandle(internal::g_core->AddDispatcher(dispatcher))); 141 MessagePipeHandle(internal::g_core->AddDispatcher(dispatcher)));
140 CHECK(rv.is_valid()); 142 CHECK(rv.is_valid());
141 return rv; 143 // TODO(vtl): The |.Pass()| below is only needed due to an MSVS bug; remove it
144 // once that's fixed.
145 return rv.Pass();
142 } 146 }
143 147
144 // TODO(vtl): Write tests for this. 148 // TODO(vtl): Write tests for this.
145 void DestroyChannel(ChannelInfo* channel_info) { 149 void DestroyChannel(ChannelInfo* channel_info) {
146 DCHECK(channel_info); 150 DCHECK(channel_info);
147 DCHECK(channel_info->channel_id); 151 DCHECK(channel_info->channel_id);
148 DCHECK(internal::g_channel_manager); 152 DCHECK(internal::g_channel_manager);
149 // This will destroy the channel synchronously if called from the channel 153 // This will destroy the channel synchronously if called from the channel
150 // thread. 154 // thread.
151 internal::g_channel_manager->ShutdownChannel(channel_info->channel_id); 155 internal::g_channel_manager->ShutdownChannel(channel_info->channel_id);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 } 203 }
200 204
201 MojoResult AsyncWait(MojoHandle handle, 205 MojoResult AsyncWait(MojoHandle handle,
202 MojoHandleSignals signals, 206 MojoHandleSignals signals,
203 base::Callback<void(MojoResult)> callback) { 207 base::Callback<void(MojoResult)> callback) {
204 return internal::g_core->AsyncWait(handle, signals, callback); 208 return internal::g_core->AsyncWait(handle, signals, callback);
205 } 209 }
206 210
207 } // namespace embedder 211 } // namespace embedder
208 } // namespace mojo 212 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698