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 | |
488 DCHECK(element->size() <= INT_MAX); | 477 DCHECK(element->size() <= INT_MAX); |
489 BOOL ok = WriteFile(pipe_.Get(), | 478 BOOL ok = WriteFile(pipe_.Get(), |
490 element->data(), | 479 element->data(), |
491 static_cast<uint32_t>(element->size()), | 480 static_cast<uint32_t>(element->size()), |
492 NULL, | 481 NULL, |
493 &output_state_.context.overlapped); | 482 &output_state_.context.overlapped); |
494 if (!ok) { | 483 if (!ok) { |
495 DWORD write_error = GetLastError(); | 484 DWORD write_error = GetLastError(); |
496 if (write_error == ERROR_IO_PENDING) { | 485 if (write_error == ERROR_IO_PENDING) { |
497 output_state_.is_pending = true; | 486 output_state_.is_pending = true; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 int secret; | 589 int secret; |
601 do { // Guarantee we get a non-zero value. | 590 do { // Guarantee we get a non-zero value. |
602 secret = base::RandInt(0, std::numeric_limits<int>::max()); | 591 secret = base::RandInt(0, std::numeric_limits<int>::max()); |
603 } while (secret == 0); | 592 } while (secret == 0); |
604 | 593 |
605 id.append(GenerateUniqueRandomChannelID()); | 594 id.append(GenerateUniqueRandomChannelID()); |
606 return id.append(base::StringPrintf("\\%d", secret)); | 595 return id.append(base::StringPrintf("\\%d", secret)); |
607 } | 596 } |
608 | 597 |
609 } // namespace IPC | 598 } // namespace IPC |
OLD | NEW |