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

Side by Side Diff: chrome/browser/policy/cloud/test_request_interceptor.cc

Issue 1476443002: Remove ScopedVector from ElementsUploadDataStream (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Created 5 years 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "chrome/browser/policy/cloud/test_request_interceptor.h" 5 #include "chrome/browser/policy/cloud/test_request_interceptor.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <queue> 8 #include <queue>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 std::string spec = request->url().spec(); 76 std::string spec = request->url().spec();
77 if (spec.find("request=" + expected_type) == std::string::npos) 77 if (spec.find("request=" + expected_type) == std::string::npos)
78 return false; 78 return false;
79 79
80 // This assumes that the payload data was set from a single string. In that 80 // This assumes that the payload data was set from a single string. In that
81 // case the UploadDataStream has a single UploadBytesElementReader with the 81 // case the UploadDataStream has a single UploadBytesElementReader with the
82 // data in memory. 82 // data in memory.
83 const net::UploadDataStream* stream = request->get_upload(); 83 const net::UploadDataStream* stream = request->get_upload();
84 if (!stream) 84 if (!stream)
85 return false; 85 return false;
86 const ScopedVector<net::UploadElementReader>* readers = 86 const std::vector<scoped_ptr<net::UploadElementReader>>* readers =
87 stream->GetElementReaders(); 87 stream->GetElementReaders();
88 if (!readers || readers->size() != 1u) 88 if (!readers || readers->size() != 1u)
89 return false; 89 return false;
90 const net::UploadBytesElementReader* reader = (*readers)[0]->AsBytesReader(); 90 const net::UploadBytesElementReader* reader = (*readers)[0]->AsBytesReader();
91 if (!reader) 91 if (!reader)
92 return false; 92 return false;
93 std::string data(reader->bytes(), reader->length()); 93 std::string data(reader->bytes(), reader->length());
94 if (!request_msg->ParseFromString(data)) 94 if (!request_msg->ParseFromString(data))
95 return false; 95 return false;
96 96
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 FROM_HERE, 333 FROM_HERE,
334 base::Bind( 334 base::Bind(
335 base::IgnoreResult(&base::TaskRunner::PostTask), 335 base::IgnoreResult(&base::TaskRunner::PostTask),
336 base::ThreadTaskRunnerHandle::Get(), 336 base::ThreadTaskRunnerHandle::Get(),
337 FROM_HERE, 337 FROM_HERE,
338 run_loop.QuitClosure())); 338 run_loop.QuitClosure()));
339 run_loop.Run(); 339 run_loop.Run();
340 } 340 }
341 341
342 } // namespace policy 342 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698