Fix for Geolocation webTCT failures
[platform/framework/web/chromium-efl.git] / url / url_canon_stdstring.cc
1 // Copyright 2013 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "url/url_canon_stdstring.h"
6
7 namespace url {
8
9 StdStringCanonOutput::StdStringCanonOutput(std::string* str) : str_(str) {
10   cur_len_ = str_->size();  // Append to existing data.
11   buffer_ = str_->empty() ? nullptr : &(*str_)[0];
12   buffer_len_ = str_->size();
13 }
14
15 StdStringCanonOutput::~StdStringCanonOutput() {
16   // Nothing to do, we don't own the string.
17 }
18
19 void StdStringCanonOutput::Complete() {
20   str_->resize(cur_len_);
21   buffer_len_ = cur_len_;
22 }
23
24 void StdStringCanonOutput::Resize(size_t sz) {
25   str_->resize(sz);
26   buffer_ = str_->empty() ? nullptr : &(*str_)[0];
27   buffer_len_ = sz;
28 }
29
30 }  // namespace url