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

Side by Side Diff: mojo/edk/system/channel.cc

Issue 1526063003: EDK: Add TaskRunner and PlatformHandleWatcher to RawChannel. (Closed) Base URL: https://github.com/domokit/mojo.git@channel_watcher
Patch Set: Created 5 years 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 | mojo/edk/system/master_connection_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/system/channel.h" 5 #include "mojo/edk/system/channel.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 29 matching lines...) Expand all
40 std::unique_ptr<RawChannel> raw_channel) { 40 std::unique_ptr<RawChannel> raw_channel) {
41 #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) 41 #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
42 DCHECK(thread_checker_.IsCreationThreadCurrent()); 42 DCHECK(thread_checker_.IsCreationThreadCurrent());
43 #endif // !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) 43 #endif // !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
44 DCHECK(raw_channel); 44 DCHECK(raw_channel);
45 45
46 // No need to take |mutex_|, since this must be called before this object 46 // No need to take |mutex_|, since this must be called before this object
47 // becomes thread-safe. 47 // becomes thread-safe.
48 DCHECK(!is_running_); 48 DCHECK(!is_running_);
49 raw_channel_ = std::move(raw_channel); 49 raw_channel_ = std::move(raw_channel);
50 // TODO(vtl): Add explicit |io_task_runner| and |io_watcher| arguments to 50 raw_channel_->Init(std::move(io_task_runner), io_watcher, this);
51 // |RawChannel::Init()| and pass them on.
52 raw_channel_->Init(this);
53 is_running_ = true; 51 is_running_ = true;
54 } 52 }
55 53
56 void Channel::SetChannelManager(ChannelManager* channel_manager) { 54 void Channel::SetChannelManager(ChannelManager* channel_manager) {
57 DCHECK(channel_manager); 55 DCHECK(channel_manager);
58 56
59 MutexLocker locker(&mutex_); 57 MutexLocker locker(&mutex_);
60 DCHECK(!is_shutting_down_); 58 DCHECK(!is_shutting_down_);
61 DCHECK(!channel_manager_); 59 DCHECK(!channel_manager_);
62 channel_manager_ = channel_manager; 60 channel_manager_ = channel_manager;
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 << ", local ID " << local_id << ", remote ID " << remote_id; 646 << ", local ID " << local_id << ", remote ID " << remote_id;
649 std::unique_ptr<MessageInTransit> message(new MessageInTransit( 647 std::unique_ptr<MessageInTransit> message(new MessageInTransit(
650 MessageInTransit::Type::CHANNEL, subtype, num_bytes, bytes)); 648 MessageInTransit::Type::CHANNEL, subtype, num_bytes, bytes));
651 message->set_source_id(local_id); 649 message->set_source_id(local_id);
652 message->set_destination_id(remote_id); 650 message->set_destination_id(remote_id);
653 return WriteMessage(std::move(message)); 651 return WriteMessage(std::move(message));
654 } 652 }
655 653
656 } // namespace system 654 } // namespace system
657 } // namespace mojo 655 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/edk/system/master_connection_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698