| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ipc/ipc_channel_win.h" | 5 #include "ipc/ipc_channel_win.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 } | 473 } |
| 474 | 474 |
| 475 if (output_queue_.empty()) | 475 if (output_queue_.empty()) |
| 476 return true; | 476 return true; |
| 477 | 477 |
| 478 if (!pipe_.IsValid()) | 478 if (!pipe_.IsValid()) |
| 479 return false; | 479 return false; |
| 480 | 480 |
| 481 // Write to pipe... | 481 // Write to pipe... |
| 482 OutputElement* element = output_queue_.front(); | 482 OutputElement* element = output_queue_.front(); |
| 483 | |
| 484 // TODO(erikchen): Temporary code to help track http://crbug.com/527588. | |
| 485 { | |
| 486 const Message* m = element->get_message(); | |
| 487 if (m) { | |
| 488 Channel::MessageVerifier verifier = Channel::GetMessageVerifier(); | |
| 489 if (verifier) | |
| 490 verifier(m); | |
| 491 } | |
| 492 } | |
| 493 | |
| 494 DCHECK(element->size() <= INT_MAX); | 483 DCHECK(element->size() <= INT_MAX); |
| 495 BOOL ok = WriteFile(pipe_.Get(), | 484 BOOL ok = WriteFile(pipe_.Get(), |
| 496 element->data(), | 485 element->data(), |
| 497 static_cast<uint32_t>(element->size()), | 486 static_cast<uint32_t>(element->size()), |
| 498 NULL, | 487 NULL, |
| 499 &output_state_.context.overlapped); | 488 &output_state_.context.overlapped); |
| 500 if (!ok) { | 489 if (!ok) { |
| 501 DWORD write_error = GetLastError(); | 490 DWORD write_error = GetLastError(); |
| 502 if (write_error == ERROR_IO_PENDING) { | 491 if (write_error == ERROR_IO_PENDING) { |
| 503 output_state_.is_pending = true; | 492 output_state_.is_pending = true; |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 int secret; | 595 int secret; |
| 607 do { // Guarantee we get a non-zero value. | 596 do { // Guarantee we get a non-zero value. |
| 608 secret = base::RandInt(0, std::numeric_limits<int>::max()); | 597 secret = base::RandInt(0, std::numeric_limits<int>::max()); |
| 609 } while (secret == 0); | 598 } while (secret == 0); |
| 610 | 599 |
| 611 id.append(GenerateUniqueRandomChannelID()); | 600 id.append(GenerateUniqueRandomChannelID()); |
| 612 return id.append(base::StringPrintf("\\%d", secret)); | 601 return id.append(base::StringPrintf("\\%d", secret)); |
| 613 } | 602 } |
| 614 | 603 |
| 615 } // namespace IPC | 604 } // namespace IPC |
| OLD | NEW |