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

Side by Side Diff: mojo/public/cpp/bindings/lib/connector.cc

Issue 480663003: Converts some DCHECKs into CHECKs in hopes of helping with a crash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/lib/interface_impl_internal.h » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "mojo/public/cpp/bindings/lib/connector.h" 5 #include "mojo/public/cpp/bindings/lib/connector.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "mojo/public/cpp/bindings/error_handler.h" 9 #include "mojo/public/cpp/bindings/error_handler.h"
10 #include "mojo/public/cpp/environment/logging.h" 10 #include "mojo/public/cpp/environment/logging.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 MOJO_DEADLINE_INDEFINITE); 56 MOJO_DEADLINE_INDEFINITE);
57 if (rv != MOJO_RESULT_OK) { 57 if (rv != MOJO_RESULT_OK) {
58 NotifyError(); 58 NotifyError();
59 return false; 59 return false;
60 } 60 }
61 mojo_ignore_result(ReadSingleMessage(&rv)); 61 mojo_ignore_result(ReadSingleMessage(&rv));
62 return (rv == MOJO_RESULT_OK); 62 return (rv == MOJO_RESULT_OK);
63 } 63 }
64 64
65 bool Connector::Accept(Message* message) { 65 bool Connector::Accept(Message* message) {
66 MOJO_DCHECK(message_pipe_.is_valid()); 66 MOJO_CHECK(message_pipe_.is_valid());
67 67
68 if (error_) 68 if (error_)
69 return false; 69 return false;
70 70
71 if (drop_writes_) 71 if (drop_writes_)
72 return true; 72 return true;
73 73
74 MojoResult rv = WriteMessageRaw( 74 MojoResult rv = WriteMessageRaw(
75 message_pipe_.get(), 75 message_pipe_.get(),
76 message->data(), 76 message->data(),
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 return true; 115 return true;
116 } 116 }
117 117
118 // static 118 // static
119 void Connector::CallOnHandleReady(void* closure, MojoResult result) { 119 void Connector::CallOnHandleReady(void* closure, MojoResult result) {
120 Connector* self = static_cast<Connector*>(closure); 120 Connector* self = static_cast<Connector*>(closure);
121 self->OnHandleReady(result); 121 self->OnHandleReady(result);
122 } 122 }
123 123
124 void Connector::OnHandleReady(MojoResult result) { 124 void Connector::OnHandleReady(MojoResult result) {
125 MOJO_DCHECK(async_wait_id_ != 0); 125 MOJO_CHECK(async_wait_id_ != 0);
126 async_wait_id_ = 0; 126 async_wait_id_ = 0;
127 if (result != MOJO_RESULT_OK) { 127 if (result != MOJO_RESULT_OK) {
128 NotifyError(); 128 NotifyError();
129 return; 129 return;
130 } 130 }
131 ReadAllAvailableMessages(); 131 ReadAllAvailableMessages();
132 // At this point, this object might have been deleted. Return. 132 // At this point, this object might have been deleted. Return.
133 } 133 }
134 134
135 void Connector::WaitToReadMore() { 135 void Connector::WaitToReadMore() {
136 MOJO_DCHECK(!async_wait_id_); 136 MOJO_CHECK(!async_wait_id_);
137 async_wait_id_ = waiter_->AsyncWait(message_pipe_.get().value(), 137 async_wait_id_ = waiter_->AsyncWait(message_pipe_.get().value(),
138 MOJO_HANDLE_SIGNAL_READABLE, 138 MOJO_HANDLE_SIGNAL_READABLE,
139 MOJO_DEADLINE_INDEFINITE, 139 MOJO_DEADLINE_INDEFINITE,
140 &Connector::CallOnHandleReady, 140 &Connector::CallOnHandleReady,
141 this); 141 this);
142 } 142 }
143 143
144 bool Connector::ReadSingleMessage(MojoResult* read_result) { 144 bool Connector::ReadSingleMessage(MojoResult* read_result) {
145 bool receiver_result = false; 145 bool receiver_result = false;
146 146
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 // should end early. 202 // should end early.
203 if (destroyed_flag_) { 203 if (destroyed_flag_) {
204 *destroyed_flag_ = true; // Propagate flag. 204 *destroyed_flag_ = true; // Propagate flag.
205 } 205 }
206 if (error_handler_) 206 if (error_handler_)
207 error_handler_->OnConnectionError(); 207 error_handler_->OnConnectionError();
208 } 208 }
209 209
210 } // namespace internal 210 } // namespace internal
211 } // namespace mojo 211 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/lib/interface_impl_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698