OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/file_path.h" | 5 #include "base/file_path.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 state_ = MASTER_END; | 542 state_ = MASTER_END; |
543 Message msg; | 543 Message msg; |
544 msg.command = QUIT; | 544 msg.command = QUIT; |
545 SendMsg(msg); | 545 SendMsg(msg); |
546 if (!IsPending()) | 546 if (!IsPending()) |
547 DoEnd(); | 547 DoEnd(); |
548 } | 548 } |
549 | 549 |
550 void MasterSM::DoEnd() { | 550 void MasterSM::DoEnd() { |
551 DEBUGMSG("Master DoEnd\n"); | 551 DEBUGMSG("Master DoEnd\n"); |
552 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask()); | 552 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
553 } | 553 } |
554 | 554 |
555 void MasterSM::Fail() { | 555 void MasterSM::Fail() { |
556 DEBUGMSG("Master Fail\n"); | 556 DEBUGMSG("Master Fail\n"); |
557 printf("Unexpected failure\n"); | 557 printf("Unexpected failure\n"); |
558 SendQuit(); | 558 SendQuit(); |
559 } | 559 } |
560 | 560 |
561 // ----------------------------------------------------------------------- | 561 // ----------------------------------------------------------------------- |
562 | 562 |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 void SlaveSM::DoReadDataComplete(int ret) { | 858 void SlaveSM::DoReadDataComplete(int ret) { |
859 DEBUGMSG("\t\t\tSlave DoReadDataComplete\n"); | 859 DEBUGMSG("\t\t\tSlave DoReadDataComplete\n"); |
860 DCHECK_EQ(READ_DATA, msg_.command); | 860 DCHECK_EQ(READ_DATA, msg_.command); |
861 msg_.buffer_bytes = (ret < 0) ? 0 : ret; | 861 msg_.buffer_bytes = (ret < 0) ? 0 : ret; |
862 msg_.result = RESULT_OK; | 862 msg_.result = RESULT_OK; |
863 SendMsg(msg_); | 863 SendMsg(msg_); |
864 } | 864 } |
865 | 865 |
866 void SlaveSM::DoEnd() { | 866 void SlaveSM::DoEnd() { |
867 DEBUGMSG("\t\t\tSlave DoEnd\n"); | 867 DEBUGMSG("\t\t\tSlave DoEnd\n"); |
868 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask()); | 868 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
869 } | 869 } |
870 | 870 |
871 void SlaveSM::Fail() { | 871 void SlaveSM::Fail() { |
872 DEBUGMSG("\t\t\tSlave Fail\n"); | 872 DEBUGMSG("\t\t\tSlave Fail\n"); |
873 printf("Unexpected failure\n"); | 873 printf("Unexpected failure\n"); |
874 state_ = SLAVE_END; | 874 state_ = SLAVE_END; |
875 if (IsPending()) { | 875 if (IsPending()) { |
876 CancelIo(channel_); | 876 CancelIo(channel_); |
877 } else { | 877 } else { |
878 DoEnd(); | 878 DoEnd(); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 | 922 |
923 SlaveSM slave(input_path, pipe); | 923 SlaveSM slave(input_path, pipe); |
924 if (!slave.DoInit()) { | 924 if (!slave.DoInit()) { |
925 printf("Unable to talk with the main process\n"); | 925 printf("Unable to talk with the main process\n"); |
926 return -1; | 926 return -1; |
927 } | 927 } |
928 | 928 |
929 loop.Run(); | 929 loop.Run(); |
930 return 0; | 930 return 0; |
931 } | 931 } |
OLD | NEW |