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/bind.h" |
| 6 #include "base/bind_helpers.h" |
5 #include "base/file_path.h" | 7 #include "base/file_path.h" |
6 #include "base/logging.h" | 8 #include "base/logging.h" |
7 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
8 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
9 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
10 #include "base/string_util.h" | 12 #include "base/string_util.h" |
11 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
12 #include "base/win/scoped_handle.h" | 14 #include "base/win/scoped_handle.h" |
13 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
14 #include "net/base/io_buffer.h" | 16 #include "net/base/io_buffer.h" |
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 DEBUGMSG("\t\t\tSlave GetEntryFromList\n"); | 728 DEBUGMSG("\t\t\tSlave GetEntryFromList\n"); |
727 if (input_->msg.long_arg1 != reinterpret_cast<int64>(entry_)) | 729 if (input_->msg.long_arg1 != reinterpret_cast<int64>(entry_)) |
728 return RESULT_INVALID_PARAMETER; | 730 return RESULT_INVALID_PARAMETER; |
729 | 731 |
730 // We know that the current iteration is valid. | 732 // We know that the current iteration is valid. |
731 if (entry_) | 733 if (entry_) |
732 entry_->Close(); | 734 entry_->Close(); |
733 | 735 |
734 int rv; | 736 int rv; |
735 if (input_->msg.command == GET_NEXT_ENTRY) { | 737 if (input_->msg.command == GET_NEXT_ENTRY) { |
736 rv = cache_->OpenNextEntry(&iterator_, | 738 rv = cache_->OpenNextEntry( |
737 reinterpret_cast<disk_cache::Entry**>(&entry_), | 739 &iterator_, reinterpret_cast<disk_cache::Entry**>(&entry_), |
738 &next_callback_); | 740 base::Bind(&SlaveSM::DoGetEntryComplete, base::Unretained(this))); |
739 } else { | 741 } else { |
740 DCHECK(input_->msg.command == GET_PREV_ENTRY); | 742 DCHECK(input_->msg.command == GET_PREV_ENTRY); |
741 rv = cache_->OpenPrevEntry(&iterator_, | 743 rv = cache_->OpenPrevEntry(&iterator_, |
742 reinterpret_cast<disk_cache::Entry**>(&entry_), | 744 reinterpret_cast<disk_cache::Entry**>(&entry_), |
743 &next_callback_); | 745 &next_callback_); |
744 } | 746 } |
745 DCHECK_EQ(net::ERR_IO_PENDING, rv); | 747 DCHECK_EQ(net::ERR_IO_PENDING, rv); |
746 return RESULT_PENDING; | 748 return RESULT_PENDING; |
747 } | 749 } |
748 | 750 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 | 924 |
923 SlaveSM slave(input_path, pipe); | 925 SlaveSM slave(input_path, pipe); |
924 if (!slave.DoInit()) { | 926 if (!slave.DoInit()) { |
925 printf("Unable to talk with the main process\n"); | 927 printf("Unable to talk with the main process\n"); |
926 return -1; | 928 return -1; |
927 } | 929 } |
928 | 930 |
929 loop.Run(); | 931 loop.Run(); |
930 return 0; | 932 return 0; |
931 } | 933 } |
OLD | NEW |