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

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

Issue 613053002: Mojo: NULL -> nullptr in mojo/public/cpp/bindings and also for the bindings generator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 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>
8
9 #include "mojo/public/cpp/bindings/error_handler.h" 7 #include "mojo/public/cpp/bindings/error_handler.h"
10 #include "mojo/public/cpp/environment/logging.h" 8 #include "mojo/public/cpp/environment/logging.h"
11 9
12 namespace mojo { 10 namespace mojo {
13 namespace internal { 11 namespace internal {
14 12
15 // ---------------------------------------------------------------------------- 13 // ----------------------------------------------------------------------------
16 14
17 Connector::Connector(ScopedMessagePipeHandle message_pipe, 15 Connector::Connector(ScopedMessagePipeHandle message_pipe,
18 const MojoAsyncWaiter* waiter) 16 const MojoAsyncWaiter* waiter)
19 : error_handler_(NULL), 17 : error_handler_(nullptr),
20 waiter_(waiter), 18 waiter_(waiter),
21 message_pipe_(message_pipe.Pass()), 19 message_pipe_(message_pipe.Pass()),
22 incoming_receiver_(NULL), 20 incoming_receiver_(nullptr),
23 async_wait_id_(0), 21 async_wait_id_(0),
24 error_(false), 22 error_(false),
25 drop_writes_(false), 23 drop_writes_(false),
26 enforce_errors_from_incoming_receiver_(true), 24 enforce_errors_from_incoming_receiver_(true),
27 destroyed_flag_(NULL) { 25 destroyed_flag_(nullptr) {
28 // Even though we don't have an incoming receiver, we still want to monitor 26 // Even though we don't have an incoming receiver, we still want to monitor
29 // the message pipe to know if is closed or encounters an error. 27 // the message pipe to know if is closed or encounters an error.
30 WaitToReadMore(); 28 WaitToReadMore();
31 } 29 }
32 30
33 Connector::~Connector() { 31 Connector::~Connector() {
34 if (destroyed_flag_) 32 if (destroyed_flag_)
35 *destroyed_flag_ = true; 33 *destroyed_flag_ = true;
36 34
37 CancelWait(); 35 CancelWait();
(...skipping 30 matching lines...) Expand all
68 if (error_) 66 if (error_)
69 return false; 67 return false;
70 68
71 if (drop_writes_) 69 if (drop_writes_)
72 return true; 70 return true;
73 71
74 MojoResult rv = WriteMessageRaw( 72 MojoResult rv = WriteMessageRaw(
75 message_pipe_.get(), 73 message_pipe_.get(),
76 message->data(), 74 message->data(),
77 message->data_num_bytes(), 75 message->data_num_bytes(),
78 message->mutable_handles()->empty() ? NULL : 76 message->mutable_handles()->empty() ? nullptr :
79 reinterpret_cast<const MojoHandle*>( 77 reinterpret_cast<const MojoHandle*>(
80 &message->mutable_handles()->front()), 78 &message->mutable_handles()->front()),
81 static_cast<uint32_t>(message->mutable_handles()->size()), 79 static_cast<uint32_t>(message->mutable_handles()->size()),
82 MOJO_WRITE_MESSAGE_FLAG_NONE); 80 MOJO_WRITE_MESSAGE_FLAG_NONE);
83 81
84 switch (rv) { 82 switch (rv) {
85 case MOJO_RESULT_OK: 83 case MOJO_RESULT_OK:
86 // The handles were successfully transferred, so we don't need the message 84 // The handles were successfully transferred, so we don't need the message
87 // to track their lifetime any longer. 85 // to track their lifetime any longer.
88 message->mutable_handles()->clear(); 86 message->mutable_handles()->clear();
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 196
199 void Connector::NotifyError() { 197 void Connector::NotifyError() {
200 error_ = true; 198 error_ = true;
201 CancelWait(); 199 CancelWait();
202 if (error_handler_) 200 if (error_handler_)
203 error_handler_->OnConnectionError(); 201 error_handler_->OnConnectionError();
204 } 202 }
205 203
206 } // namespace internal 204 } // namespace internal
207 } // namespace mojo 205 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/bindings_serialization.cc ('k') | mojo/public/cpp/bindings/lib/filter_chain.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698