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

Side by Side Diff: content/browser/renderer_host/resource_dispatcher_host_unittest.cc

Issue 10696135: Offload disk accesses to WorkerPool in ExtensionProtocolHandler (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/renderer_host/resource_dispatcher_host_impl.h" 5 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 private: 304 private:
305 virtual bool NextReadAsync() OVERRIDE { return true; } 305 virtual bool NextReadAsync() OVERRIDE { return true; }
306 }; 306 };
307 307
308 class URLRequestBigJob : public net::URLRequestSimpleJob { 308 class URLRequestBigJob : public net::URLRequestSimpleJob {
309 public: 309 public:
310 URLRequestBigJob(net::URLRequest* request) 310 URLRequestBigJob(net::URLRequest* request)
311 : net::URLRequestSimpleJob(request) { 311 : net::URLRequestSimpleJob(request) {
312 } 312 }
313 313
314 virtual bool GetData(std::string* mime_type, 314 virtual int GetData(std::string* mime_type,
315 std::string* charset, 315 std::string* charset,
316 std::string* data) const { 316 std::string* data,
317 const net::CompletionCallback& callback) const OVERRIDE {
317 *mime_type = "text/plain"; 318 *mime_type = "text/plain";
318 *charset = "UTF-8"; 319 *charset = "UTF-8";
319 320
320 std::string text; 321 std::string text;
321 int count; 322 int count;
322 if (!ParseURL(request_->url(), &text, &count)) 323 if (!ParseURL(request_->url(), &text, &count))
323 return false; 324 return net::ERR_INVALID_URL;
324 325
325 data->reserve(text.size() * count); 326 data->reserve(text.size() * count);
326 for (int i = 0; i < count; ++i) 327 for (int i = 0; i < count; ++i)
327 data->append(text); 328 data->append(text);
328 329
329 return true; 330 return net::OK;
330 } 331 }
331 332
332 private: 333 private:
333 virtual ~URLRequestBigJob() {} 334 virtual ~URLRequestBigJob() {}
334 335
335 // big-job:substring,N 336 // big-job:substring,N
336 static bool ParseURL(const GURL& url, std::string* text, int* count) { 337 static bool ParseURL(const GURL& url, std::string* text, int* count) {
337 std::vector<std::string> parts; 338 std::vector<std::string> parts;
338 base::SplitString(url.path(), ',', &parts); 339 base::SplitString(url.path(), ',', &parts);
339 340
(...skipping 1406 matching lines...) Expand 10 before | Expand all | Expand 10 after
1746 } 1747 }
1747 1748
1748 MessageLoop::current()->RunAllPending(); 1749 MessageLoop::current()->RunAllPending();
1749 1750
1750 msgs.clear(); 1751 msgs.clear();
1751 accum_.GetClassifiedMessages(&msgs); 1752 accum_.GetClassifiedMessages(&msgs);
1752 } 1753 }
1753 } 1754 }
1754 1755
1755 } // namespace content 1756 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/histogram_internals_request_job.cc ('k') | content/browser/tcmalloc_internals_request_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698