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

Side by Side Diff: third_party/WebKit/Source/platform/network/EncodedFormData.cpp

Issue 2957513002: Removed calls to RefPtr::Release in return statements with auto move. (Closed)
Patch Set: rebased Created 3 years, 5 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 | « third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp ('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 /* 1 /*
2 * Copyright (C) 2004, 2006, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2008, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Google Inc. All rights reserved. 3 * Copyright (C) 2009 Google Inc. All rights reserved.
4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 EncodedFormData::~EncodedFormData() {} 46 EncodedFormData::~EncodedFormData() {}
47 47
48 PassRefPtr<EncodedFormData> EncodedFormData::Create() { 48 PassRefPtr<EncodedFormData> EncodedFormData::Create() {
49 return AdoptRef(new EncodedFormData); 49 return AdoptRef(new EncodedFormData);
50 } 50 }
51 51
52 PassRefPtr<EncodedFormData> EncodedFormData::Create(const void* data, 52 PassRefPtr<EncodedFormData> EncodedFormData::Create(const void* data,
53 size_t size) { 53 size_t size) {
54 RefPtr<EncodedFormData> result = Create(); 54 RefPtr<EncodedFormData> result = Create();
55 result->AppendData(data, size); 55 result->AppendData(data, size);
56 return result.Release(); 56 return result;
57 } 57 }
58 58
59 PassRefPtr<EncodedFormData> EncodedFormData::Create(const CString& string) { 59 PassRefPtr<EncodedFormData> EncodedFormData::Create(const CString& string) {
60 RefPtr<EncodedFormData> result = Create(); 60 RefPtr<EncodedFormData> result = Create();
61 result->AppendData(string.data(), string.length()); 61 result->AppendData(string.data(), string.length());
62 return result.Release(); 62 return result;
63 } 63 }
64 64
65 PassRefPtr<EncodedFormData> EncodedFormData::Create( 65 PassRefPtr<EncodedFormData> EncodedFormData::Create(
66 const Vector<char>& vector) { 66 const Vector<char>& vector) {
67 RefPtr<EncodedFormData> result = Create(); 67 RefPtr<EncodedFormData> result = Create();
68 result->AppendData(vector.data(), vector.size()); 68 result->AppendData(vector.data(), vector.size());
69 return result.Release(); 69 return result;
70 } 70 }
71 71
72 PassRefPtr<EncodedFormData> EncodedFormData::Copy() const { 72 PassRefPtr<EncodedFormData> EncodedFormData::Copy() const {
73 return AdoptRef(new EncodedFormData(*this)); 73 return AdoptRef(new EncodedFormData(*this));
74 } 74 }
75 75
76 PassRefPtr<EncodedFormData> EncodedFormData::DeepCopy() const { 76 PassRefPtr<EncodedFormData> EncodedFormData::DeepCopy() const {
77 RefPtr<EncodedFormData> form_data(Create()); 77 RefPtr<EncodedFormData> form_data(Create());
78 78
79 form_data->identifier_ = identifier_; 79 form_data->identifier_ = identifier_;
(...skipping 17 matching lines...) Expand all
97 form_data->elements_.UncheckedAppend(FormDataElement( 97 form_data->elements_.UncheckedAppend(FormDataElement(
98 e.blob_uuid_.IsolatedCopy(), e.optional_blob_data_handle_)); 98 e.blob_uuid_.IsolatedCopy(), e.optional_blob_data_handle_));
99 break; 99 break;
100 case FormDataElement::kEncodedFileSystemURL: 100 case FormDataElement::kEncodedFileSystemURL:
101 form_data->elements_.UncheckedAppend(FormDataElement( 101 form_data->elements_.UncheckedAppend(FormDataElement(
102 e.file_system_url_.Copy(), e.file_start_, e.file_length_, 102 e.file_system_url_.Copy(), e.file_start_, e.file_length_,
103 e.expected_file_modification_time_)); 103 e.expected_file_modification_time_));
104 break; 104 break;
105 } 105 }
106 } 106 }
107 return form_data.Release(); 107 return form_data;
108 } 108 }
109 109
110 void EncodedFormData::AppendData(const void* data, size_t size) { 110 void EncodedFormData::AppendData(const void* data, size_t size) {
111 if (elements_.IsEmpty() || elements_.back().type_ != FormDataElement::kData) 111 if (elements_.IsEmpty() || elements_.back().type_ != FormDataElement::kData)
112 elements_.push_back(FormDataElement()); 112 elements_.push_back(FormDataElement());
113 FormDataElement& e = elements_.back(); 113 FormDataElement& e = elements_.back();
114 size_t old_size = e.data_.size(); 114 size_t old_size = e.data_.size();
115 e.data_.Grow(old_size + size); 115 e.data_.Grow(old_size + size);
116 memcpy(e.data_.data() + old_size, data, size); 116 memcpy(e.data_.data() + old_size, data, size);
117 } 117 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 if (!HasOneRef()) 194 if (!HasOneRef())
195 return false; 195 return false;
196 for (auto& element : elements_) { 196 for (auto& element : elements_) {
197 if (!element.IsSafeToSendToAnotherThread()) 197 if (!element.IsSafeToSendToAnotherThread())
198 return false; 198 return false;
199 } 199 }
200 return true; 200 return true;
201 } 201 }
202 202
203 } // namespace blink 203 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698