| 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 <stddef.h> | 5 #include <stddef.h> | 
| 6 #include <stdint.h> | 6 #include <stdint.h> | 
| 7 | 7 | 
| 8 #include <vector> | 8 #include <vector> | 
| 9 | 9 | 
| 10 #include "base/bind.h" | 10 #include "base/bind.h" | 
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 443   char buffer_[48]; | 443   char buffer_[48]; | 
| 444   MessageLoopForIO::IOContext context_; | 444   MessageLoopForIO::IOContext context_; | 
| 445   HANDLE signal_; | 445   HANDLE signal_; | 
| 446   win::ScopedHandle file_; | 446   win::ScopedHandle file_; | 
| 447   bool wait_; | 447   bool wait_; | 
| 448 }; | 448 }; | 
| 449 | 449 | 
| 450 TestIOHandler::TestIOHandler(const wchar_t* name, HANDLE signal, bool wait) | 450 TestIOHandler::TestIOHandler(const wchar_t* name, HANDLE signal, bool wait) | 
| 451     : signal_(signal), wait_(wait) { | 451     : signal_(signal), wait_(wait) { | 
| 452   memset(buffer_, 0, sizeof(buffer_)); | 452   memset(buffer_, 0, sizeof(buffer_)); | 
| 453   memset(&context_, 0, sizeof(context_)); |  | 
| 454   context_.handler = this; |  | 
| 455 | 453 | 
| 456   file_.Set(CreateFile(name, GENERIC_READ, 0, NULL, OPEN_EXISTING, | 454   file_.Set(CreateFile(name, GENERIC_READ, 0, NULL, OPEN_EXISTING, | 
| 457                        FILE_FLAG_OVERLAPPED, NULL)); | 455                        FILE_FLAG_OVERLAPPED, NULL)); | 
| 458   EXPECT_TRUE(file_.IsValid()); | 456   EXPECT_TRUE(file_.IsValid()); | 
| 459 } | 457 } | 
| 460 | 458 | 
| 461 void TestIOHandler::Init() { | 459 void TestIOHandler::Init() { | 
| 462   MessageLoopForIO::current()->RegisterIOHandler(file_.Get(), this); | 460   MessageLoopForIO::current()->RegisterIOHandler(file_.Get(), this); | 
| 463 | 461 | 
| 464   DWORD read; | 462   DWORD read; | 
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 972   // already has another active loop. This happens when thread creation fails. | 970   // already has another active loop. This happens when thread creation fails. | 
| 973   MessageLoop loop; | 971   MessageLoop loop; | 
| 974   std::unique_ptr<MessageLoop> unbound_loop(MessageLoop::CreateUnbound( | 972   std::unique_ptr<MessageLoop> unbound_loop(MessageLoop::CreateUnbound( | 
| 975       MessageLoop::TYPE_DEFAULT, MessageLoop::MessagePumpFactoryCallback())); | 973       MessageLoop::TYPE_DEFAULT, MessageLoop::MessagePumpFactoryCallback())); | 
| 976   unbound_loop.reset(); | 974   unbound_loop.reset(); | 
| 977   EXPECT_EQ(&loop, MessageLoop::current()); | 975   EXPECT_EQ(&loop, MessageLoop::current()); | 
| 978   EXPECT_EQ(loop.task_runner(), ThreadTaskRunnerHandle::Get()); | 976   EXPECT_EQ(loop.task_runner(), ThreadTaskRunnerHandle::Get()); | 
| 979 } | 977 } | 
| 980 | 978 | 
| 981 }  // namespace base | 979 }  // namespace base | 
| OLD | NEW | 
|---|