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

Side by Side Diff: net/url_request/url_request_simple_job.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 "net/url_request/url_request_simple_job.h" 5 #include "net/url_request/url_request_simple_job.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 memcpy(buf->data(), data_.data() + data_offset_, buf_size); 50 memcpy(buf->data(), data_.data() + data_offset_, buf_size);
51 data_offset_ += buf_size; 51 data_offset_ += buf_size;
52 *bytes_read = buf_size; 52 *bytes_read = buf_size;
53 return true; 53 return true;
54 } 54 }
55 55
56 void URLRequestSimpleJob::StartAsync() { 56 void URLRequestSimpleJob::StartAsync() {
57 if (!request_) 57 if (!request_)
58 return; 58 return;
59 59
60 if (GetData(&mime_type_, &charset_, &data_)) { 60 int result = GetData(&mime_type_, &charset_, &data_,
61 base::Bind(&URLRequestSimpleJob::OnGetDataCompleted,
62 weak_factory_.GetWeakPtr()));
63 if (result != ERR_IO_PENDING)
64 OnGetDataCompleted(result);
65 }
66
67 void URLRequestSimpleJob::OnGetDataCompleted(int result) {
68 if (result == OK) {
61 // Notify that the headers are complete 69 // Notify that the headers are complete
62 NotifyHeadersComplete(); 70 NotifyHeadersComplete();
63 } else { 71 } else {
64 // what should the error code be? 72 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, result));
65 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED,
66 ERR_INVALID_URL));
67 } 73 }
68 } 74 }
69 75
70 } // namespace net 76 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_simple_job.h ('k') | webkit/appcache/view_appcache_internals_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698