Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: net/http/http_cache.cc

Issue 3056029: Move the number conversions from string_util to a new file.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/ftp/ftp_auth_cache_unittest.cc ('k') | net/http/http_network_transaction.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "net/http/http_cache.h" 5 #include "net/http/http_cache.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 10
11 #if defined(OS_POSIX) 11 #if defined(OS_POSIX)
12 #include <unistd.h> 12 #include <unistd.h>
13 #endif 13 #endif
14 14
15 #include "base/callback.h" 15 #include "base/callback.h"
16 #include "base/format_macros.h" 16 #include "base/format_macros.h"
17 #include "base/message_loop.h" 17 #include "base/message_loop.h"
18 #include "base/pickle.h" 18 #include "base/pickle.h"
19 #include "base/ref_counted.h" 19 #include "base/ref_counted.h"
20 #include "base/stl_util-inl.h" 20 #include "base/stl_util-inl.h"
21 #include "base/string_util.h" 21 #include "base/string_util.h"
22 #include "base/string_number_conversions.h"
22 #include "net/base/io_buffer.h" 23 #include "net/base/io_buffer.h"
23 #include "net/base/load_flags.h" 24 #include "net/base/load_flags.h"
24 #include "net/base/net_errors.h" 25 #include "net/base/net_errors.h"
25 #include "net/disk_cache/disk_cache.h" 26 #include "net/disk_cache/disk_cache.h"
26 #include "net/http/http_cache_transaction.h" 27 #include "net/http/http_cache_transaction.h"
27 #include "net/http/http_network_layer.h" 28 #include "net/http/http_network_layer.h"
28 #include "net/http/http_network_session.h" 29 #include "net/http/http_network_session.h"
29 #include "net/http/http_request_info.h" 30 #include "net/http/http_request_info.h"
30 #include "net/http/http_response_headers.h" 31 #include "net/http/http_response_headers.h"
31 #include "net/http/http_response_info.h" 32 #include "net/http/http_response_info.h"
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 // generation number. During playback, multiple fetches for the same 460 // generation number. During playback, multiple fetches for the same
460 // item will use the same generation number and pull the proper 461 // item will use the same generation number and pull the proper
461 // instance of an URL from the cache. 462 // instance of an URL from the cache.
462 int generation = 0; 463 int generation = 0;
463 DCHECK(playback_cache_map_ != NULL); 464 DCHECK(playback_cache_map_ != NULL);
464 if (playback_cache_map_->find(url) != playback_cache_map_->end()) 465 if (playback_cache_map_->find(url) != playback_cache_map_->end())
465 generation = (*playback_cache_map_)[url]; 466 generation = (*playback_cache_map_)[url];
466 (*playback_cache_map_)[url] = generation + 1; 467 (*playback_cache_map_)[url] = generation + 1;
467 468
468 // The key into the cache is GENERATION # + METHOD + URL. 469 // The key into the cache is GENERATION # + METHOD + URL.
469 std::string result = IntToString(generation); 470 std::string result = base::IntToString(generation);
470 result.append(request->method); 471 result.append(request->method);
471 result.append(url); 472 result.append(url);
472 return result; 473 return result;
473 } 474 }
474 475
475 int HttpCache::DoomEntry(const std::string& key, Transaction* trans) { 476 int HttpCache::DoomEntry(const std::string& key, Transaction* trans) {
476 // Need to abandon the ActiveEntry, but any transaction attached to the entry 477 // Need to abandon the ActiveEntry, but any transaction attached to the entry
477 // should not be impacted. Dooming an entry only means that it will no 478 // should not be impacted. Dooming an entry only means that it will no
478 // longer be returned by FindActiveEntry (and it will also be destroyed once 479 // longer be returned by FindActiveEntry (and it will also be destroyed once
479 // all consumers are finished with the entry). 480 // all consumers are finished with the entry).
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 // This could be an external caller or a transaction waiting on Start(). 1024 // This could be an external caller or a transaction waiting on Start().
1024 pending_item->DoCallback(result, temp_backend_); 1025 pending_item->DoCallback(result, temp_backend_);
1025 pending_item->NotifyTransaction(result, NULL); 1026 pending_item->NotifyTransaction(result, NULL);
1026 } 1027 }
1027 1028
1028 DeletePendingOp(pending_op); 1029 DeletePendingOp(pending_op);
1029 building_backend_ = false; 1030 building_backend_ = false;
1030 } 1031 }
1031 1032
1032 } // namespace net 1033 } // namespace net
OLDNEW
« no previous file with comments | « net/ftp/ftp_auth_cache_unittest.cc ('k') | net/http/http_network_transaction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698