| OLD | NEW | 
|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ipc/mojo/async_handle_waiter.h" | 5 #include "ipc/mojo/async_handle_waiter.h" | 
| 6 | 6 | 
| 7 #include "base/atomic_ref_count.h" | 7 #include "base/atomic_ref_count.h" | 
| 8 #include "base/bind.h" | 8 #include "base/bind.h" | 
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" | 
| 10 #include "base/location.h" | 10 #include "base/location.h" | 
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 79 | 79 | 
| 80   // IOObserver implementation: | 80   // IOObserver implementation: | 
| 81 | 81 | 
| 82   void WillProcessIOEvent() override { | 82   void WillProcessIOEvent() override { | 
| 83     DCHECK(io_loop_level_ != 0 || !should_invoke_callback_); | 83     DCHECK(io_loop_level_ != 0 || !should_invoke_callback_); | 
| 84     DCHECK_GE(io_loop_level_, 0); | 84     DCHECK_GE(io_loop_level_, 0); | 
| 85     io_loop_level_++; | 85     io_loop_level_++; | 
| 86   } | 86   } | 
| 87 | 87 | 
| 88   void DidProcessIOEvent() override { | 88   void DidProcessIOEvent() override { | 
|  | 89     // This object could have been constructed in another's class's | 
|  | 90     // DidProcessIOEvent. | 
|  | 91     if (io_loop_level_== 0) | 
|  | 92       return; | 
|  | 93 | 
| 89     DCHECK_GE(io_loop_level_, 1); | 94     DCHECK_GE(io_loop_level_, 1); | 
| 90 | 95 | 
| 91     // Leaving a nested loop. | 96     // Leaving a nested loop. | 
| 92     if (io_loop_level_ > 1) { | 97     if (io_loop_level_ > 1) { | 
| 93       io_loop_level_--; | 98       io_loop_level_--; | 
| 94       return; | 99       return; | 
| 95     } | 100     } | 
| 96 | 101 | 
| 97     // The zero |waiter_| indicates that |this| have lost the owner and can be | 102     // The zero |waiter_| indicates that |this| have lost the owner and can be | 
| 98     // under destruction. So we cannot wrap it with a |scoped_refptr| anymore. | 103     // under destruction. So we cannot wrap it with a |scoped_refptr| anymore. | 
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 156 void AsyncHandleWaiterContextTraits::Destruct( | 161 void AsyncHandleWaiterContextTraits::Destruct( | 
| 157     const AsyncHandleWaiter::Context* context) { | 162     const AsyncHandleWaiter::Context* context) { | 
| 158   context->io_runner_->PostTask( | 163   context->io_runner_->PostTask( | 
| 159       FROM_HERE, | 164       FROM_HERE, | 
| 160       base::Bind(&base::DeletePointer<const AsyncHandleWaiter::Context>, | 165       base::Bind(&base::DeletePointer<const AsyncHandleWaiter::Context>, | 
| 161                  base::Unretained(context))); | 166                  base::Unretained(context))); | 
| 162 } | 167 } | 
| 163 | 168 | 
| 164 }  // namespace internal | 169 }  // namespace internal | 
| 165 }  // namespace IPC | 170 }  // namespace IPC | 
| OLD | NEW | 
|---|