OLD | NEW |
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/system/raw_channel.h" | 5 #include "mojo/system/raw_channel.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 // afterwards. | 155 // afterwards. |
156 bool pending_write_; | 156 bool pending_write_; |
157 base::MessageLoopForIO::IOContext write_context_; | 157 base::MessageLoopForIO::IOContext write_context_; |
158 | 158 |
159 DISALLOW_COPY_AND_ASSIGN(RawChannelIOHandler); | 159 DISALLOW_COPY_AND_ASSIGN(RawChannelIOHandler); |
160 }; | 160 }; |
161 | 161 |
162 // |RawChannel| private methods: | 162 // |RawChannel| private methods: |
163 virtual IOResult Read(size_t* bytes_read) OVERRIDE; | 163 virtual IOResult Read(size_t* bytes_read) OVERRIDE; |
164 virtual IOResult ScheduleRead() OVERRIDE; | 164 virtual IOResult ScheduleRead() OVERRIDE; |
| 165 virtual scoped_ptr<embedder::PlatformHandleVector> GetReadPlatformHandles( |
| 166 size_t num_platform_handles, |
| 167 const void* platform_handle_table) OVERRIDE; |
165 virtual IOResult WriteNoLock(size_t* platform_handles_written, | 168 virtual IOResult WriteNoLock(size_t* platform_handles_written, |
166 size_t* bytes_written) OVERRIDE; | 169 size_t* bytes_written) OVERRIDE; |
167 virtual IOResult ScheduleWriteNoLock() OVERRIDE; | 170 virtual IOResult ScheduleWriteNoLock() OVERRIDE; |
168 virtual bool OnInit() OVERRIDE; | 171 virtual bool OnInit() OVERRIDE; |
169 virtual void OnShutdownNoLock( | 172 virtual void OnShutdownNoLock( |
170 scoped_ptr<ReadBuffer> read_buffer, | 173 scoped_ptr<ReadBuffer> read_buffer, |
171 scoped_ptr<WriteBuffer> write_buffer) OVERRIDE; | 174 scoped_ptr<WriteBuffer> write_buffer) OVERRIDE; |
172 | 175 |
173 // Passed to |io_handler_| during initialization. | 176 // Passed to |io_handler_| during initialization. |
174 embedder::ScopedPlatformHandle handle_; | 177 embedder::ScopedPlatformHandle handle_; |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 base::Unretained(io_handler_), | 421 base::Unretained(io_handler_), |
419 base::Unretained(io_handler_->read_context()), | 422 base::Unretained(io_handler_->read_context()), |
420 static_cast<DWORD>(bytes_read), | 423 static_cast<DWORD>(bytes_read), |
421 ERROR_SUCCESS)); | 424 ERROR_SUCCESS)); |
422 return IO_PENDING; | 425 return IO_PENDING; |
423 } | 426 } |
424 | 427 |
425 return io_result; | 428 return io_result; |
426 } | 429 } |
427 | 430 |
| 431 scoped_ptr<embedder::PlatformHandleVector> |
| 432 RawChannelWin::GetReadPlatformHandles( |
| 433 size_t num_platform_handles, |
| 434 const void* platform_handle_table) { |
| 435 // TODO(vtl): Implement. |
| 436 NOTIMPLEMENTED(); |
| 437 return scoped_ptr<embedder::PlatformHandleVector>(); |
| 438 } |
| 439 |
428 RawChannel::IOResult RawChannelWin::WriteNoLock( | 440 RawChannel::IOResult RawChannelWin::WriteNoLock( |
429 size_t* platform_handles_written, | 441 size_t* platform_handles_written, |
430 size_t* bytes_written) { | 442 size_t* bytes_written) { |
431 write_lock().AssertAcquired(); | 443 write_lock().AssertAcquired(); |
432 | 444 |
433 DCHECK(io_handler_); | 445 DCHECK(io_handler_); |
434 DCHECK(!io_handler_->pending_write_no_lock()); | 446 DCHECK(!io_handler_->pending_write_no_lock()); |
435 | 447 |
436 if (write_buffer_no_lock()->HavePlatformHandlesToSend()) { | 448 if (write_buffer_no_lock()->HavePlatformHandlesToSend()) { |
437 // TODO(vtl): Implement. | 449 // TODO(vtl): Implement. |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 | 560 |
549 // Static factory method declared in raw_channel.h. | 561 // Static factory method declared in raw_channel.h. |
550 // static | 562 // static |
551 scoped_ptr<RawChannel> RawChannel::Create( | 563 scoped_ptr<RawChannel> RawChannel::Create( |
552 embedder::ScopedPlatformHandle handle) { | 564 embedder::ScopedPlatformHandle handle) { |
553 return scoped_ptr<RawChannel>(new RawChannelWin(handle.Pass())); | 565 return scoped_ptr<RawChannel>(new RawChannelWin(handle.Pass())); |
554 } | 566 } |
555 | 567 |
556 } // namespace system | 568 } // namespace system |
557 } // namespace mojo | 569 } // namespace mojo |
OLD | NEW |