OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ppapi/thunk/enter.h" | 5 #include "ppapi/thunk/enter.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 retval_(PP_OK) { | 55 retval_(PP_OK) { |
56 callback_ = new TrackedCallback(resource_, callback); | 56 callback_ = new TrackedCallback(resource_, callback); |
57 | 57 |
58 // TODO(dmichael) validate that threads have an associated message loop. | 58 // TODO(dmichael) validate that threads have an associated message loop. |
59 } | 59 } |
60 | 60 |
61 EnterBase::~EnterBase() { | 61 EnterBase::~EnterBase() { |
62 // callback_ is cleared any time it is run, scheduled to be run, or once we | 62 // callback_ is cleared any time it is run, scheduled to be run, or once we |
63 // know it will be completed asynchronously. So by this point it should be | 63 // know it will be completed asynchronously. So by this point it should be |
64 // NULL. | 64 // NULL. |
65 DCHECK(!callback_); | 65 DCHECK(!callback_) << "|callback_| is not NULL. Did you forget to call " |
| 66 "|EnterBase::SetResult| in the interface's thunk?"; |
66 } | 67 } |
67 | 68 |
68 int32_t EnterBase::SetResult(int32_t result) { | 69 int32_t EnterBase::SetResult(int32_t result) { |
69 if (!callback_) { | 70 if (!callback_) { |
70 // It doesn't make sense to call SetResult if there is no callback. | 71 // It doesn't make sense to call SetResult if there is no callback. |
71 NOTREACHED(); | 72 NOTREACHED(); |
72 retval_ = result; | 73 retval_ = result; |
73 return result; | 74 return result; |
74 } | 75 } |
75 if (result == PP_OK_COMPLETIONPENDING) { | 76 if (result == PP_OK_COMPLETIONPENDING) { |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 : EnterBase(), | 265 : EnterBase(), |
265 functions_(PpapiGlobals::Get()->GetResourceCreationAPI(instance)) { | 266 functions_(PpapiGlobals::Get()->GetResourceCreationAPI(instance)) { |
266 SetStateForFunctionError(instance, functions_, true); | 267 SetStateForFunctionError(instance, functions_, true); |
267 } | 268 } |
268 | 269 |
269 EnterResourceCreationNoLock::~EnterResourceCreationNoLock() { | 270 EnterResourceCreationNoLock::~EnterResourceCreationNoLock() { |
270 } | 271 } |
271 | 272 |
272 } // namespace thunk | 273 } // namespace thunk |
273 } // namespace ppapi | 274 } // namespace ppapi |
OLD | NEW |