| OLD | NEW | 
|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <stdint.h> | 7 #include <stdint.h> | 
| 8 #include <windows.h> | 8 #include <windows.h> | 
| 9 | 9 | 
| 10 #include <algorithm> | 10 #include <algorithm> | 
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 73  public: | 73  public: | 
| 74   ChannelWin(Delegate* delegate, | 74   ChannelWin(Delegate* delegate, | 
| 75              ScopedPlatformHandle handle, | 75              ScopedPlatformHandle handle, | 
| 76              scoped_refptr<base::TaskRunner> io_task_runner) | 76              scoped_refptr<base::TaskRunner> io_task_runner) | 
| 77       : Channel(delegate), | 77       : Channel(delegate), | 
| 78         self_(this), | 78         self_(this), | 
| 79         handle_(std::move(handle)), | 79         handle_(std::move(handle)), | 
| 80         io_task_runner_(io_task_runner) { | 80         io_task_runner_(io_task_runner) { | 
| 81     sentinel_ = ~reinterpret_cast<uintptr_t>(this); | 81     sentinel_ = ~reinterpret_cast<uintptr_t>(this); | 
| 82     CHECK(handle_.is_valid()); | 82     CHECK(handle_.is_valid()); | 
| 83     memset(&read_context_, 0, sizeof(read_context_)); |  | 
| 84     read_context_.handler = this; |  | 
| 85 |  | 
| 86     memset(&write_context_, 0, sizeof(write_context_)); |  | 
| 87     write_context_.handler = this; |  | 
| 88   } | 83   } | 
| 89 | 84 | 
| 90   void Start() override { | 85   void Start() override { | 
| 91     io_task_runner_->PostTask( | 86     io_task_runner_->PostTask( | 
| 92         FROM_HERE, base::Bind(&ChannelWin::StartOnIOThread, this)); | 87         FROM_HERE, base::Bind(&ChannelWin::StartOnIOThread, this)); | 
| 93   } | 88   } | 
| 94 | 89 | 
| 95   void ShutDownImpl() override { | 90   void ShutDownImpl() override { | 
| 96     // Always shut down asynchronously when called through the public interface. | 91     // Always shut down asynchronously when called through the public interface. | 
| 97     io_task_runner_->PostTask( | 92     io_task_runner_->PostTask( | 
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 317 // static | 312 // static | 
| 318 scoped_refptr<Channel> Channel::Create( | 313 scoped_refptr<Channel> Channel::Create( | 
| 319     Delegate* delegate, | 314     Delegate* delegate, | 
| 320     ScopedPlatformHandle platform_handle, | 315     ScopedPlatformHandle platform_handle, | 
| 321     scoped_refptr<base::TaskRunner> io_task_runner) { | 316     scoped_refptr<base::TaskRunner> io_task_runner) { | 
| 322   return new ChannelWin(delegate, std::move(platform_handle), io_task_runner); | 317   return new ChannelWin(delegate, std::move(platform_handle), io_task_runner); | 
| 323 } | 318 } | 
| 324 | 319 | 
| 325 }  // namespace edk | 320 }  // namespace edk | 
| 326 }  // namespace mojo | 321 }  // namespace mojo | 
| OLD | NEW | 
|---|