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

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: Nits Created 6 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
« net/base/io_buffer.h ('K') | « 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
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() { 49 StringIOBuffer::~StringIOBuffer() {
50 // We haven't allocated the buffer, so remove it before the base class 50 // We haven't allocated the buffer, so remove it before the base class
51 // destructor tries to delete[] it. 51 // destructor tries to delete[] it.
52 data_ = NULL; 52 data_ = NULL;
53 } 53 }
54 54
55 ZeroCopyStringIOBuffer::ZeroCopyStringIOBuffer(std::string* s) : IOBuffer() {
56 string_.swap(*s);
57 CHECK_LT(s->size(), static_cast<size_t>(INT_MAX));
58 data_ = const_cast<char*>(string_.data());
59 }
60
61 ZeroCopyStringIOBuffer::~ZeroCopyStringIOBuffer() {
62 data_ = NULL;
michaeln 2014/08/14 22:59:01 is this needed? oh i see the comment in ~StringIOB
jkarlin 2014/08/15 11:49:44 No longer necessary after merge into StringIOBuffe
63 }
64
55 DrainableIOBuffer::DrainableIOBuffer(IOBuffer* base, int size) 65 DrainableIOBuffer::DrainableIOBuffer(IOBuffer* base, int size)
56 : IOBuffer(base->data()), 66 : IOBuffer(base->data()),
57 base_(base), 67 base_(base),
58 size_(size), 68 size_(size),
59 used_(0) { 69 used_(0) {
60 } 70 }
61 71
62 void DrainableIOBuffer::DidConsume(int bytes) { 72 void DrainableIOBuffer::DidConsume(int bytes) {
63 SetOffset(used_ + bytes); 73 SetOffset(used_ + bytes);
64 } 74 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 140
131 WrappedIOBuffer::WrappedIOBuffer(const char* data) 141 WrappedIOBuffer::WrappedIOBuffer(const char* data)
132 : IOBuffer(const_cast<char*>(data)) { 142 : IOBuffer(const_cast<char*>(data)) {
133 } 143 }
134 144
135 WrappedIOBuffer::~WrappedIOBuffer() { 145 WrappedIOBuffer::~WrappedIOBuffer() {
136 data_ = NULL; 146 data_ = NULL;
137 } 147 }
138 148
139 } // namespace net 149 } // namespace net
OLDNEW
« net/base/io_buffer.h ('K') | « net/base/io_buffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698