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

Side by Side Diff: net/base/io_buffer.cc

Issue 465463002: Initial implementation of ServiceWorkerCache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cache2
Patch Set: Default backend Created 6 years, 3 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
« no previous file with comments | « net/base/io_buffer.h ('k') | no next file » | 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) 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 "net/base/io_buffer.h" 5 #include "net/base/io_buffer.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace net { 9 namespace net {
10 10
(...skipping 28 matching lines...) Expand all
39 IOBufferWithSize::~IOBufferWithSize() { 39 IOBufferWithSize::~IOBufferWithSize() {
40 } 40 }
41 41
42 StringIOBuffer::StringIOBuffer(const std::string& s) 42 StringIOBuffer::StringIOBuffer(const std::string& s)
43 : IOBuffer(static_cast<char*>(NULL)), 43 : IOBuffer(static_cast<char*>(NULL)),
44 string_data_(s) { 44 string_data_(s) {
45 CHECK_LT(s.size(), static_cast<size_t>(INT_MAX)); 45 CHECK_LT(s.size(), static_cast<size_t>(INT_MAX));
46 data_ = const_cast<char*>(string_data_.data()); 46 data_ = const_cast<char*>(string_data_.data());
47 } 47 }
48 48
49 StringIOBuffer::StringIOBuffer(scoped_ptr<std::string> s)
50 : IOBuffer(static_cast<char*>(NULL)) {
51 CHECK_LT(s->size(), static_cast<size_t>(INT_MAX));
52 string_data_.swap(*s.get());
53 data_ = const_cast<char*>(string_data_.data());
54 }
55
49 StringIOBuffer::~StringIOBuffer() { 56 StringIOBuffer::~StringIOBuffer() {
50 // We haven't allocated the buffer, so remove it before the base class 57 // We haven't allocated the buffer, so remove it before the base class
51 // destructor tries to delete[] it. 58 // destructor tries to delete[] it.
52 data_ = NULL; 59 data_ = NULL;
53 } 60 }
54 61
55 DrainableIOBuffer::DrainableIOBuffer(IOBuffer* base, int size) 62 DrainableIOBuffer::DrainableIOBuffer(IOBuffer* base, int size)
56 : IOBuffer(base->data()), 63 : IOBuffer(base->data()),
57 base_(base), 64 base_(base),
58 size_(size), 65 size_(size),
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 137
131 WrappedIOBuffer::WrappedIOBuffer(const char* data) 138 WrappedIOBuffer::WrappedIOBuffer(const char* data)
132 : IOBuffer(const_cast<char*>(data)) { 139 : IOBuffer(const_cast<char*>(data)) {
133 } 140 }
134 141
135 WrappedIOBuffer::~WrappedIOBuffer() { 142 WrappedIOBuffer::~WrappedIOBuffer() {
136 data_ = NULL; 143 data_ = NULL;
137 } 144 }
138 145
139 } // namespace net 146 } // namespace net
OLDNEW
« no previous file with comments | « net/base/io_buffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698