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 "net/tools/dump_cache/upgrade_win.h" | 5 #include "net/tools/dump_cache/upgrade_win.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 | 886 |
887 DWORD mode = PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_INSTANCE | | 887 DWORD mode = PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_INSTANCE | |
888 FILE_FLAG_OVERLAPPED; | 888 FILE_FLAG_OVERLAPPED; |
889 | 889 |
890 return CreateNamedPipe(pipe_name.c_str(), mode, 0, 1, kChannelSize, | 890 return CreateNamedPipe(pipe_name.c_str(), mode, 0, 1, kChannelSize, |
891 kChannelSize, 0, NULL); | 891 kChannelSize, 0, NULL); |
892 } | 892 } |
893 | 893 |
894 // This is the controller process for an upgrade operation. | 894 // This is the controller process for an upgrade operation. |
895 int UpgradeCache(const base::FilePath& output_path, HANDLE pipe) { | 895 int UpgradeCache(const base::FilePath& output_path, HANDLE pipe) { |
896 base::MessageLoop loop(base::MessageLoop::TYPE_IO); | 896 base::MessageLoopForIO loop; |
897 | 897 |
898 MasterSM master(output_path, pipe); | 898 MasterSM master(output_path, pipe); |
899 if (!master.DoInit()) { | 899 if (!master.DoInit()) { |
900 printf("Unable to talk with the helper\n"); | 900 printf("Unable to talk with the helper\n"); |
901 return -1; | 901 return -1; |
902 } | 902 } |
903 | 903 |
904 loop.Run(); | 904 loop.Run(); |
905 return 0; | 905 return 0; |
906 } | 906 } |
907 | 907 |
908 // This process will only execute commands from the controller. | 908 // This process will only execute commands from the controller. |
909 int RunSlave(const base::FilePath& input_path, | 909 int RunSlave(const base::FilePath& input_path, |
910 const base::string16& pipe_number) { | 910 const base::string16& pipe_number) { |
911 base::MessageLoop loop(base::MessageLoop::TYPE_IO); | 911 base::MessageLoopForIO loop; |
912 | 912 |
913 base::win::ScopedHandle pipe(OpenServer(pipe_number)); | 913 base::win::ScopedHandle pipe(OpenServer(pipe_number)); |
914 if (!pipe.IsValid()) { | 914 if (!pipe.IsValid()) { |
915 printf("Unable to open the server pipe\n"); | 915 printf("Unable to open the server pipe\n"); |
916 return -1; | 916 return -1; |
917 } | 917 } |
918 | 918 |
919 SlaveSM slave(input_path, pipe); | 919 SlaveSM slave(input_path, pipe); |
920 if (!slave.DoInit()) { | 920 if (!slave.DoInit()) { |
921 printf("Unable to talk with the main process\n"); | 921 printf("Unable to talk with the main process\n"); |
922 return -1; | 922 return -1; |
923 } | 923 } |
924 | 924 |
925 loop.Run(); | 925 loop.Run(); |
926 return 0; | 926 return 0; |
927 } | 927 } |
OLD | NEW |