| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/globals.h" | 5 #include "platform/globals.h" |
| 6 #if defined(TARGET_OS_WINDOWS) | 6 #if defined(TARGET_OS_WINDOWS) |
| 7 | 7 |
| 8 #include "bin/eventhandler.h" | 8 #include "bin/eventhandler.h" |
| 9 | 9 |
| 10 #include <winsock2.h> // NOLINT | 10 #include <winsock2.h> // NOLINT |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 } | 265 } |
| 266 OverlappedBuffer::DisposeBuffer(buffer); | 266 OverlappedBuffer::DisposeBuffer(buffer); |
| 267 HandleIssueError(); | 267 HandleIssueError(); |
| 268 return false; | 268 return false; |
| 269 } else { | 269 } else { |
| 270 // Completing asynchronously through thread. | 270 // Completing asynchronously through thread. |
| 271 pending_read_ = buffer; | 271 pending_read_ = buffer; |
| 272 int result = dart::Thread::Start(ReadFileThread, | 272 int result = dart::Thread::Start(ReadFileThread, |
| 273 reinterpret_cast<uword>(this)); | 273 reinterpret_cast<uword>(this)); |
| 274 if (result != 0) { | 274 if (result != 0) { |
| 275 FATAL("Failed to start read file thread %d", result); | 275 FATAL1("Failed to start read file thread %d", result); |
| 276 } | 276 } |
| 277 return true; | 277 return true; |
| 278 } | 278 } |
| 279 } | 279 } |
| 280 | 280 |
| 281 | 281 |
| 282 bool Handle::IssueWrite() { | 282 bool Handle::IssueWrite() { |
| 283 ScopedLock lock(this); | 283 ScopedLock lock(this); |
| 284 ASSERT(type_ != kListenSocket); | 284 ASSERT(type_ != kListenSocket); |
| 285 ASSERT(completion_port_ != INVALID_HANDLE_VALUE); | 285 ASSERT(completion_port_ != INVALID_HANDLE_VALUE); |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 if (thread_wrote_ > 0) { | 621 if (thread_wrote_ > 0) { |
| 622 if (num_bytes > thread_wrote_) num_bytes = thread_wrote_; | 622 if (num_bytes > thread_wrote_) num_bytes = thread_wrote_; |
| 623 thread_wrote_ -= num_bytes; | 623 thread_wrote_ -= num_bytes; |
| 624 return num_bytes; | 624 return num_bytes; |
| 625 } | 625 } |
| 626 if (!write_thread_exists_) { | 626 if (!write_thread_exists_) { |
| 627 write_thread_exists_ = true; | 627 write_thread_exists_ = true; |
| 628 int result = dart::Thread::Start(WriteFileThread, | 628 int result = dart::Thread::Start(WriteFileThread, |
| 629 reinterpret_cast<uword>(this)); | 629 reinterpret_cast<uword>(this)); |
| 630 if (result != 0) { | 630 if (result != 0) { |
| 631 FATAL("Failed to start write file thread %d", result); | 631 FATAL1("Failed to start write file thread %d", result); |
| 632 } | 632 } |
| 633 while (!write_thread_running_) { | 633 while (!write_thread_running_) { |
| 634 // Wait until we the thread is running. | 634 // Wait until we the thread is running. |
| 635 locker.Wait(Monitor::kNoTimeout); | 635 locker.Wait(Monitor::kNoTimeout); |
| 636 } | 636 } |
| 637 } | 637 } |
| 638 // Create buffer and notify thread about the new handle. | 638 // Create buffer and notify thread about the new handle. |
| 639 pending_write_ = OverlappedBuffer::AllocateWriteBuffer(num_bytes); | 639 pending_write_ = OverlappedBuffer::AllocateWriteBuffer(num_bytes); |
| 640 pending_write_->Write(buffer, num_bytes); | 640 pending_write_->Write(buffer, num_bytes); |
| 641 locker.Notify(); | 641 locker.Notify(); |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1132 | 1132 |
| 1133 | 1133 |
| 1134 void EventHandlerImplementation::Shutdown() { | 1134 void EventHandlerImplementation::Shutdown() { |
| 1135 SendData(kShutdownId, 0, 0); | 1135 SendData(kShutdownId, 0, 0); |
| 1136 } | 1136 } |
| 1137 | 1137 |
| 1138 } // namespace bin | 1138 } // namespace bin |
| 1139 } // namespace dart | 1139 } // namespace dart |
| 1140 | 1140 |
| 1141 #endif // defined(TARGET_OS_WINDOWS) | 1141 #endif // defined(TARGET_OS_WINDOWS) |
| OLD | NEW |