| 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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 } | 467 } |
| 468 | 468 |
| 469 if (output_queue_.empty()) | 469 if (output_queue_.empty()) |
| 470 return true; | 470 return true; |
| 471 | 471 |
| 472 if (!pipe_.IsValid()) | 472 if (!pipe_.IsValid()) |
| 473 return false; | 473 return false; |
| 474 | 474 |
| 475 // Write to pipe... | 475 // Write to pipe... |
| 476 OutputElement* element = output_queue_.front(); | 476 OutputElement* element = output_queue_.front(); |
| 477 |
| 478 // TODO(erikchen): Temporary code to help track http://crbug.com/527588. |
| 479 { |
| 480 const Message* m = element->get_message(); |
| 481 if (m) { |
| 482 Channel::MessageVerifier verifier = Channel::GetMessageVerifier(); |
| 483 if (verifier) |
| 484 verifier(m); |
| 485 } |
| 486 } |
| 487 |
| 477 DCHECK(element->size() <= INT_MAX); | 488 DCHECK(element->size() <= INT_MAX); |
| 478 BOOL ok = WriteFile(pipe_.Get(), | 489 BOOL ok = WriteFile(pipe_.Get(), |
| 479 element->data(), | 490 element->data(), |
| 480 static_cast<uint32_t>(element->size()), | 491 static_cast<uint32_t>(element->size()), |
| 481 NULL, | 492 NULL, |
| 482 &output_state_.context.overlapped); | 493 &output_state_.context.overlapped); |
| 483 if (!ok) { | 494 if (!ok) { |
| 484 DWORD write_error = GetLastError(); | 495 DWORD write_error = GetLastError(); |
| 485 if (write_error == ERROR_IO_PENDING) { | 496 if (write_error == ERROR_IO_PENDING) { |
| 486 output_state_.is_pending = true; | 497 output_state_.is_pending = true; |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 int secret; | 600 int secret; |
| 590 do { // Guarantee we get a non-zero value. | 601 do { // Guarantee we get a non-zero value. |
| 591 secret = base::RandInt(0, std::numeric_limits<int>::max()); | 602 secret = base::RandInt(0, std::numeric_limits<int>::max()); |
| 592 } while (secret == 0); | 603 } while (secret == 0); |
| 593 | 604 |
| 594 id.append(GenerateUniqueRandomChannelID()); | 605 id.append(GenerateUniqueRandomChannelID()); |
| 595 return id.append(base::StringPrintf("\\%d", secret)); | 606 return id.append(base::StringPrintf("\\%d", secret)); |
| 596 } | 607 } |
| 597 | 608 |
| 598 } // namespace IPC | 609 } // namespace IPC |
| OLD | NEW |