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

Side by Side Diff: net/disk_cache/flash/internal_entry.cc

Issue 15829004: Update net/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: license twerk Created 7 years, 6 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
OLDNEW
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/disk_cache/flash/internal_entry.h" 5 #include "net/disk_cache/flash/internal_entry.h"
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "net/base/completion_callback.h" 8 #include "net/base/completion_callback.h"
9 #include "net/base/io_buffer.h" 9 #include "net/base/io_buffer.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 return entry_->WriteData(++index, offset, buf, buf_len); 64 return entry_->WriteData(++index, offset, buf, buf_len);
65 } 65 }
66 66
67 void InternalEntry::Close() { 67 void InternalEntry::Close() {
68 entry_->Close(); 68 entry_->Close();
69 } 69 }
70 70
71 bool InternalEntry::WriteKey(LogStoreEntry* entry, const std::string& key) { 71 bool InternalEntry::WriteKey(LogStoreEntry* entry, const std::string& key) {
72 int key_size = static_cast<int>(key.size()); 72 int key_size = static_cast<int>(key.size());
73 scoped_refptr<IOBuffer> key_buf(new StringIOBuffer(key)); 73 scoped_refptr<IOBuffer> key_buf(new StringIOBuffer(key));
74 return entry->WriteData(0, 0, key_buf, key_size) == key_size; 74 return entry->WriteData(0, 0, key_buf.get(), key_size) == key_size;
75 } 75 }
76 76
77 bool InternalEntry::ReadKey(LogStoreEntry* entry, std::string* key) { 77 bool InternalEntry::ReadKey(LogStoreEntry* entry, std::string* key) {
78 int key_size = entry->GetDataSize(0); 78 int key_size = entry->GetDataSize(0);
79 scoped_refptr<net::IOBuffer> key_buf(new net::IOBuffer(key_size)); 79 scoped_refptr<net::IOBuffer> key_buf(new net::IOBuffer(key_size));
80 if (entry->ReadData(0, 0, key_buf, key_size) != key_size) 80 if (entry->ReadData(0, 0, key_buf.get(), key_size) != key_size)
81 return false; 81 return false;
82 key->assign(key_buf->data(), key_size); 82 key->assign(key_buf->data(), key_size);
83 return true; 83 return true;
84 } 84 }
85 85
86 } // namespace disk_cache 86 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/disk_cache/flash/flash_entry_impl.cc ('k') | net/disk_cache/flash/log_store_entry_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698