Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/application/public/cpp/application_connection.h" | 5 #include "mojo/application/public/cpp/application_connection.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | |
| 8 | |
| 7 namespace mojo { | 9 namespace mojo { |
| 8 | 10 |
| 11 ApplicationConnection::ApplicationConnection() : connection_closed_(false) { | |
| 12 } | |
| 13 | |
| 9 ApplicationConnection::~ApplicationConnection() { | 14 ApplicationConnection::~ApplicationConnection() { |
|
sky
2015/06/29 23:38:38
nit: move to match position in header.
Fady Samuel
2015/06/30 15:07:22
Done.
| |
| 15 // If this DCHECK fails then something has tried to delete this object without | |
| 16 // calling CloseConnection. | |
| 17 DCHECK(connection_closed_); | |
| 18 } | |
| 19 | |
| 20 void ApplicationConnection::CloseConnection() { | |
| 21 if (connection_closed_) | |
| 22 return; | |
| 23 OnCloseConnection(); | |
| 24 connection_closed_ = true; | |
| 25 delete this; | |
| 10 } | 26 } |
| 11 | 27 |
| 12 } // namespace mojo | 28 } // namespace mojo |
| OLD | NEW |