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/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 } // namespace | 26 } // namespace |
27 | 27 |
28 namespace thunk { | 28 namespace thunk { |
29 | 29 |
30 namespace subtle { | 30 namespace subtle { |
31 | 31 |
32 EnterBase::EnterBase() | 32 EnterBase::EnterBase() |
33 : resource_(NULL), | 33 : resource_(NULL), |
34 retval_(PP_OK) { | 34 retval_(PP_OK) { |
| 35 PpapiGlobals::Get()->MarkPluginIsActive(); |
35 } | 36 } |
36 | 37 |
37 EnterBase::EnterBase(PP_Resource resource) | 38 EnterBase::EnterBase(PP_Resource resource) |
38 : resource_(GetResource(resource)), | 39 : resource_(GetResource(resource)), |
39 retval_(PP_OK) { | 40 retval_(PP_OK) { |
| 41 PpapiGlobals::Get()->MarkPluginIsActive(); |
40 } | 42 } |
41 | 43 |
42 EnterBase::EnterBase(PP_Instance instance, SingletonResourceID resource_id) | 44 EnterBase::EnterBase(PP_Instance instance, SingletonResourceID resource_id) |
43 : resource_(GetSingletonResource(instance, resource_id)), | 45 : resource_(GetSingletonResource(instance, resource_id)), |
44 retval_(PP_OK) { | 46 retval_(PP_OK) { |
| 47 PpapiGlobals::Get()->MarkPluginIsActive(); |
45 } | 48 } |
46 | 49 |
47 EnterBase::EnterBase(PP_Resource resource, | 50 EnterBase::EnterBase(PP_Resource resource, |
48 const PP_CompletionCallback& callback) | 51 const PP_CompletionCallback& callback) |
49 : resource_(GetResource(resource)), | 52 : resource_(GetResource(resource)), |
50 retval_(PP_OK) { | 53 retval_(PP_OK) { |
51 callback_ = new TrackedCallback(resource_, callback); | 54 callback_ = new TrackedCallback(resource_, callback); |
| 55 PpapiGlobals::Get()->MarkPluginIsActive(); |
52 } | 56 } |
53 | 57 |
54 EnterBase::EnterBase(PP_Instance instance, SingletonResourceID resource_id, | 58 EnterBase::EnterBase(PP_Instance instance, SingletonResourceID resource_id, |
55 const PP_CompletionCallback& callback) | 59 const PP_CompletionCallback& callback) |
56 : resource_(GetSingletonResource(instance, resource_id)), | 60 : resource_(GetSingletonResource(instance, resource_id)), |
57 retval_(PP_OK) { | 61 retval_(PP_OK) { |
58 DCHECK(resource_ || !instance); | 62 DCHECK(resource_ || !instance); |
59 if (!resource_) | 63 if (!resource_) |
60 retval_ = PP_ERROR_BADARGUMENT; | 64 retval_ = PP_ERROR_BADARGUMENT; |
61 callback_ = new TrackedCallback(resource_, callback); | 65 callback_ = new TrackedCallback(resource_, callback); |
| 66 PpapiGlobals::Get()->MarkPluginIsActive(); |
62 } | 67 } |
63 | 68 |
64 EnterBase::~EnterBase() { | 69 EnterBase::~EnterBase() { |
65 // callback_ is cleared any time it is run, scheduled to be run, or once we | 70 // callback_ is cleared any time it is run, scheduled to be run, or once we |
66 // know it will be completed asynchronously. So by this point it should be | 71 // know it will be completed asynchronously. So by this point it should be |
67 // NULL. | 72 // NULL. |
68 DCHECK(!callback_.get()) | 73 DCHECK(!callback_.get()) |
69 << "|callback_| is not NULL. Did you forget to call " | 74 << "|callback_| is not NULL. Did you forget to call " |
70 "|EnterBase::SetResult| in the interface's thunk?"; | 75 "|EnterBase::SetResult| in the interface's thunk?"; |
71 } | 76 } |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 : EnterBase(), | 310 : EnterBase(), |
306 functions_(PpapiGlobals::Get()->GetResourceCreationAPI(instance)) { | 311 functions_(PpapiGlobals::Get()->GetResourceCreationAPI(instance)) { |
307 SetStateForFunctionError(instance, functions_, true); | 312 SetStateForFunctionError(instance, functions_, true); |
308 } | 313 } |
309 | 314 |
310 EnterResourceCreationNoLock::~EnterResourceCreationNoLock() { | 315 EnterResourceCreationNoLock::~EnterResourceCreationNoLock() { |
311 } | 316 } |
312 | 317 |
313 } // namespace thunk | 318 } // namespace thunk |
314 } // namespace ppapi | 319 } // namespace ppapi |
OLD | NEW |