OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 | 319 |
320 if (dump_to_disk_) { | 320 if (dump_to_disk_) { |
321 writer_ = new DiskDumper(path_); | 321 writer_ = new DiskDumper(path_); |
322 } else { | 322 } else { |
323 disk_cache::Backend* cache; | 323 disk_cache::Backend* cache; |
324 TestCompletionCallback cb; | 324 TestCompletionCallback cb; |
325 int rv = disk_cache::CreateCacheBackend(net::DISK_CACHE, | 325 int rv = disk_cache::CreateCacheBackend(net::DISK_CACHE, |
326 FilePath::FromWStringHack(path_), 0, | 326 FilePath::FromWStringHack(path_), 0, |
327 false, | 327 false, |
328 cache_thread_.message_loop_proxy(), | 328 cache_thread_.message_loop_proxy(), |
329 NULL, &cache, &cb); | 329 &cache, &cb); |
330 if (cb.GetResult(rv) != net::OK) { | 330 if (cb.GetResult(rv) != net::OK) { |
331 printf("Unable to initialize new files\n"); | 331 printf("Unable to initialize new files\n"); |
332 return false; | 332 return false; |
333 } | 333 } |
334 cache_.reset(cache); | 334 cache_.reset(cache); |
335 writer_ = new CacheDumper(cache_.get()); | 335 writer_ = new CacheDumper(cache_.get()); |
336 } | 336 } |
337 if (!writer_) | 337 if (!writer_) |
338 return false; | 338 return false; |
339 | 339 |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 ALLOW_THIS_IN_INITIALIZER_LIST( | 600 ALLOW_THIS_IN_INITIALIZER_LIST( |
601 read_callback_(this, &SlaveSM::DoReadDataComplete)), | 601 read_callback_(this, &SlaveSM::DoReadDataComplete)), |
602 ALLOW_THIS_IN_INITIALIZER_LIST( | 602 ALLOW_THIS_IN_INITIALIZER_LIST( |
603 next_callback_(this, &SlaveSM::DoGetEntryComplete)) { | 603 next_callback_(this, &SlaveSM::DoGetEntryComplete)) { |
604 disk_cache::Backend* cache; | 604 disk_cache::Backend* cache; |
605 TestCompletionCallback cb; | 605 TestCompletionCallback cb; |
606 int rv = disk_cache::CreateCacheBackend(net::DISK_CACHE, | 606 int rv = disk_cache::CreateCacheBackend(net::DISK_CACHE, |
607 FilePath::FromWStringHack(path), 0, | 607 FilePath::FromWStringHack(path), 0, |
608 false, | 608 false, |
609 cache_thread_.message_loop_proxy(), | 609 cache_thread_.message_loop_proxy(), |
610 NULL, &cache, &cb); | 610 &cache, &cb); |
611 if (cb.GetResult(rv) != net::OK) { | 611 if (cb.GetResult(rv) != net::OK) { |
612 printf("Unable to open cache files\n"); | 612 printf("Unable to open cache files\n"); |
613 return; | 613 return; |
614 } | 614 } |
615 cache_.reset(reinterpret_cast<disk_cache::BackendImpl*>(cache)); | 615 cache_.reset(reinterpret_cast<disk_cache::BackendImpl*>(cache)); |
616 cache_->SetUpgradeMode(); | 616 cache_->SetUpgradeMode(); |
617 } | 617 } |
618 | 618 |
619 SlaveSM::~SlaveSM() { | 619 SlaveSM::~SlaveSM() { |
620 if (iterator_) | 620 if (iterator_) |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 | 920 |
921 SlaveSM slave(input_path, pipe); | 921 SlaveSM slave(input_path, pipe); |
922 if (!slave.DoInit()) { | 922 if (!slave.DoInit()) { |
923 printf("Unable to talk with the main process\n"); | 923 printf("Unable to talk with the main process\n"); |
924 return -1; | 924 return -1; |
925 } | 925 } |
926 | 926 |
927 loop.Run(); | 927 loop.Run(); |
928 return 0; | 928 return 0; |
929 } | 929 } |
OLD | NEW |