Service Worker: Start coalescing SWVersion's timers.
[chromium-blink-merge.git] / url / url_canon_stdstring.cc
blob366a2e070fc24672b2736bbcc6ec2213723d33e1
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "url/url_canon_stdstring.h"
7 namespace url {
9 StdStringCanonOutput::StdStringCanonOutput(std::string* str)
10 : CanonOutput(), str_(str) {
11 cur_len_ = static_cast<int>(str_->size()); // Append to existing data.
12 str_->resize(str_->capacity());
13 buffer_ = str_->empty() ? NULL : &(*str_)[0];
14 buffer_len_ = static_cast<int>(str_->size());
17 StdStringCanonOutput::~StdStringCanonOutput() {
18 // Nothing to do, we don't own the string.
21 void StdStringCanonOutput::Complete() {
22 str_->resize(cur_len_);
23 buffer_len_ = cur_len_;
26 void StdStringCanonOutput::Resize(int sz) {
27 str_->resize(sz);
28 buffer_ = str_->empty() ? NULL : &(*str_)[0];
29 buffer_len_ = sz;
32 } // namespace url