OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/proxy/host_dispatcher.h" | 5 #include "ppapi/proxy/host_dispatcher.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 ModuleToDispatcherMap::const_iterator found = | 33 ModuleToDispatcherMap::const_iterator found = |
34 g_module_to_dispatcher->find(module); | 34 g_module_to_dispatcher->find(module); |
35 if (found == g_module_to_dispatcher->end()) { | 35 if (found == g_module_to_dispatcher->end()) { |
36 NOTREACHED(); | 36 NOTREACHED(); |
37 return PP_TRUE; | 37 return PP_TRUE; |
38 } | 38 } |
39 | 39 |
40 bool usable = true; | 40 bool usable = true; |
41 if (!found->second->Send(new PpapiMsg_ReserveInstanceId(instance, &usable))) | 41 if (!found->second->Send(new PpapiMsg_ReserveInstanceId(instance, &usable))) |
42 return PP_TRUE; | 42 return PP_TRUE; |
43 return BoolToPPBool(usable); | 43 return PP_FromBool(usable); |
44 } | 44 } |
45 | 45 |
46 // Saves the state of the given bool and puts it back when it goes out of | 46 // Saves the state of the given bool and puts it back when it goes out of |
47 // scope. | 47 // scope. |
48 class BoolRestorer { | 48 class BoolRestorer { |
49 public: | 49 public: |
50 BoolRestorer(bool* var) : var_(var), old_value_(*var) { | 50 BoolRestorer(bool* var) : var_(var), old_value_(*var) { |
51 } | 51 } |
52 ~BoolRestorer() { | 52 ~BoolRestorer() { |
53 *var_ = old_value_; | 53 *var_ = old_value_; |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 dispatcher_->ppb_proxy()->AddRefModule(dispatcher_->pp_module()); | 265 dispatcher_->ppb_proxy()->AddRefModule(dispatcher_->pp_module()); |
266 } | 266 } |
267 | 267 |
268 ScopedModuleReference::~ScopedModuleReference() { | 268 ScopedModuleReference::~ScopedModuleReference() { |
269 dispatcher_->ppb_proxy()->ReleaseModule(dispatcher_->pp_module()); | 269 dispatcher_->ppb_proxy()->ReleaseModule(dispatcher_->pp_module()); |
270 } | 270 } |
271 | 271 |
272 } // namespace proxy | 272 } // namespace proxy |
273 } // namespace pp | 273 } // namespace pp |
274 | 274 |
OLD | NEW |