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

Side by Side Diff: remoting/host/native_messaging/pipe_messaging_channel.cc

Issue 810133003: replace NULL->nullptr in src/remoting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 "remoting/host/native_messaging/pipe_messaging_channel.h" 5 #include "remoting/host/native_messaging/pipe_messaging_channel.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 } // namespace 42 } // namespace
43 43
44 namespace remoting { 44 namespace remoting {
45 45
46 PipeMessagingChannel::PipeMessagingChannel( 46 PipeMessagingChannel::PipeMessagingChannel(
47 base::File input, 47 base::File input,
48 base::File output) 48 base::File output)
49 : native_messaging_reader_(DuplicatePlatformFile(input.Pass())), 49 : native_messaging_reader_(DuplicatePlatformFile(input.Pass())),
50 native_messaging_writer_(new NativeMessagingWriter( 50 native_messaging_writer_(new NativeMessagingWriter(
51 DuplicatePlatformFile(output.Pass()))), 51 DuplicatePlatformFile(output.Pass()))),
52 event_handler_(NULL), 52 event_handler_(nullptr),
53 weak_factory_(this) { 53 weak_factory_(this) {
54 weak_ptr_ = weak_factory_.GetWeakPtr(); 54 weak_ptr_ = weak_factory_.GetWeakPtr();
55 } 55 }
56 56
57 PipeMessagingChannel::~PipeMessagingChannel() { 57 PipeMessagingChannel::~PipeMessagingChannel() {
58 } 58 }
59 59
60 void PipeMessagingChannel::Start(EventHandler* event_handler) { 60 void PipeMessagingChannel::Start(EventHandler* event_handler) {
61 DCHECK(CalledOnValidThread()); 61 DCHECK(CalledOnValidThread());
62 DCHECK(!event_handler_); 62 DCHECK(!event_handler_);
(...skipping 25 matching lines...) Expand all
88 // Close the write pipe so no more responses will be sent. 88 // Close the write pipe so no more responses will be sent.
89 native_messaging_writer_.reset(); 89 native_messaging_writer_.reset();
90 Shutdown(); 90 Shutdown();
91 } 91 }
92 } 92 }
93 93
94 void PipeMessagingChannel::Shutdown() { 94 void PipeMessagingChannel::Shutdown() {
95 DCHECK(CalledOnValidThread()); 95 DCHECK(CalledOnValidThread());
96 96
97 if (event_handler_) { 97 if (event_handler_) {
98 // Set event_handler_ to NULL to indicate the object is in a shutdown cycle. 98 // Set |event_handler_| to nullptr to indicate the object is in a shutdown
99 // Since event_handler->OnDisconnect() will destroy the current object, 99 // cycle. Since event_handler->OnDisconnect() will destroy the current
100 // |event_handler_| will become a dangling pointer after OnDisconnect() 100 // object, |event_handler_| will become a dangling pointer after
101 // returns. Therefore, we set |event_handler_| to NULL beforehand. 101 // OnDisconnect() returns. Therefore, we set |event_handler_| to nullptr
102 // beforehand.
102 EventHandler* handler = event_handler_; 103 EventHandler* handler = event_handler_;
103 event_handler_ = NULL; 104 event_handler_ = nullptr;
104 handler->OnDisconnect(); 105 handler->OnDisconnect();
105 } 106 }
106 } 107 }
107 108
108 } // namespace remoting 109 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/native_messaging/native_messaging_writer_unittest.cc ('k') | remoting/host/pairing_registry_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698