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

Side by Side Diff: content/child/url_response_body_consumer.cc

Issue 2493503002: Revert of Add virtual tests for XHR with mojo-loading (Closed)
Patch Set: Created 4 years, 1 month 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 | « no previous file | third_party/WebKit/LayoutTests/TestExpectations » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/child/url_response_body_consumer.h" 5 #include "content/child/url_response_body_consumer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "content/child/resource_dispatcher.h" 10 #include "content/child/resource_dispatcher.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 80
81 void URLResponseBodyConsumer::Reclaim(uint32_t size) { 81 void URLResponseBodyConsumer::Reclaim(uint32_t size) {
82 MojoResult result = mojo::EndReadDataRaw(handle_.get(), size); 82 MojoResult result = mojo::EndReadDataRaw(handle_.get(), size);
83 DCHECK_EQ(MOJO_RESULT_OK, result); 83 DCHECK_EQ(MOJO_RESULT_OK, result);
84 } 84 }
85 85
86 void URLResponseBodyConsumer::OnReadable(MojoResult unused) { 86 void URLResponseBodyConsumer::OnReadable(MojoResult unused) {
87 if (has_been_cancelled_ || has_seen_end_of_data_) 87 if (has_been_cancelled_ || has_seen_end_of_data_)
88 return; 88 return;
89 89
90 // Protect |this| as RequestPeer::OnReceivedData may call deref.
91 scoped_refptr<URLResponseBodyConsumer> protect(this);
92
93 // TODO(yhirano): Suppress notification when deferred. 90 // TODO(yhirano): Suppress notification when deferred.
94 while (!has_been_cancelled_) { 91 while (!has_been_cancelled_) {
95 const void* buffer = nullptr; 92 const void* buffer = nullptr;
96 uint32_t available = 0; 93 uint32_t available = 0;
97 MojoResult result = mojo::BeginReadDataRaw( 94 MojoResult result = mojo::BeginReadDataRaw(
98 handle_.get(), &buffer, &available, MOJO_READ_DATA_FLAG_NONE); 95 handle_.get(), &buffer, &available, MOJO_READ_DATA_FLAG_NONE);
99 if (result == MOJO_RESULT_SHOULD_WAIT) 96 if (result == MOJO_RESULT_SHOULD_WAIT)
100 return; 97 return;
101 if (result == MOJO_RESULT_FAILED_PRECONDITION) { 98 if (result == MOJO_RESULT_FAILED_PRECONDITION) {
102 has_seen_end_of_data_ = true; 99 has_seen_end_of_data_ = true;
(...skipping 22 matching lines...) Expand all
125 return; 122 return;
126 // Cancel this instance in order not to notify twice. 123 // Cancel this instance in order not to notify twice.
127 Cancel(); 124 Cancel();
128 125
129 resource_dispatcher_->OnMessageReceived( 126 resource_dispatcher_->OnMessageReceived(
130 ResourceMsg_RequestComplete(request_id_, completion_status_)); 127 ResourceMsg_RequestComplete(request_id_, completion_status_));
131 // |this| may be deleted. 128 // |this| may be deleted.
132 } 129 }
133 130
134 } // namespace content 131 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/TestExpectations » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698