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 "webkit/plugins/ppapi/resource_tracker.h" | 5 #include "webkit/plugins/ppapi/resource_tracker.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/rand_util.h" | 11 #include "base/rand_util.h" |
12 #include "ppapi/c/pp_resource.h" | 12 #include "ppapi/c/pp_resource.h" |
13 #include "ppapi/c/pp_var.h" | 13 #include "ppapi/c/pp_var.h" |
14 #include "ppapi/shared_impl/tracker_base.h" | 14 #include "ppapi/shared_impl/tracker_base.h" |
15 #include "webkit/plugins/ppapi/plugin_module.h" | 15 #include "webkit/plugins/ppapi/plugin_module.h" |
16 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 16 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
17 #include "webkit/plugins/ppapi/resource.h" | 17 #include "webkit/plugins/ppapi/resource.h" |
18 #include "webkit/plugins/ppapi/ppb_font_impl.h" | |
viettrungluu
2011/05/18 21:07:46
alphabetical order
| |
18 #include "webkit/plugins/ppapi/resource_creation_impl.h" | 19 #include "webkit/plugins/ppapi/resource_creation_impl.h" |
19 #include "webkit/plugins/ppapi/var.h" | 20 #include "webkit/plugins/ppapi/var.h" |
20 | 21 |
21 enum PPIdType { | 22 enum PPIdType { |
22 PP_ID_TYPE_MODULE, | 23 PP_ID_TYPE_MODULE, |
23 PP_ID_TYPE_INSTANCE, | 24 PP_ID_TYPE_INSTANCE, |
24 PP_ID_TYPE_RESOURCE, | 25 PP_ID_TYPE_RESOURCE, |
25 PP_ID_TYPE_VAR, | 26 PP_ID_TYPE_VAR, |
26 PP_ID_TYPE_COUNT | 27 PP_ID_TYPE_COUNT |
27 }; | 28 }; |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
247 return NULL; | 248 return NULL; |
248 return result->second.first.get(); | 249 return result->second.first.get(); |
249 } | 250 } |
250 | 251 |
251 ::ppapi::FunctionGroupBase* ResourceTracker::GetFunctionAPI( | 252 ::ppapi::FunctionGroupBase* ResourceTracker::GetFunctionAPI( |
252 PP_Instance inst, | 253 PP_Instance inst, |
253 pp::proxy::InterfaceID id) { | 254 pp::proxy::InterfaceID id) { |
254 if (function_proxies_[id].get()) | 255 if (function_proxies_[id].get()) |
255 return function_proxies_[id].get(); | 256 return function_proxies_[id].get(); |
256 | 257 |
258 // TODO(brettw) we need a better system for doing this. | |
257 if (id == ::pp::proxy::INTERFACE_ID_RESOURCE_CREATION) | 259 if (id == ::pp::proxy::INTERFACE_ID_RESOURCE_CREATION) |
258 function_proxies_[id].reset(new ResourceCreationImpl()); | 260 function_proxies_[id].reset(new ResourceCreationImpl()); |
261 else if (id == ::pp::proxy::INTERFACE_ID_PPB_FONT) | |
262 function_proxies_[id].reset(new PPB_Font_FunctionImpl); | |
259 | 263 |
260 return function_proxies_[id].get(); | 264 return function_proxies_[id].get(); |
261 } | 265 } |
262 | 266 |
263 scoped_refptr<Var> ResourceTracker::GetVar(int32 var_id) const { | 267 scoped_refptr<Var> ResourceTracker::GetVar(int32 var_id) const { |
264 DLOG_IF(ERROR, !CheckIdType(var_id, PP_ID_TYPE_VAR)) | 268 DLOG_IF(ERROR, !CheckIdType(var_id, PP_ID_TYPE_VAR)) |
265 << var_id << " is not a PP_Var ID."; | 269 << var_id << " is not a PP_Var ID."; |
266 VarMap::const_iterator result = live_vars_.find(var_id); | 270 VarMap::const_iterator result = live_vars_.find(var_id); |
267 if (result == live_vars_.end()) | 271 if (result == live_vars_.end()) |
268 return scoped_refptr<Var>(); | 272 return scoped_refptr<Var>(); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
384 | 388 |
385 // static | 389 // static |
386 void ResourceTracker::ClearSingletonOverride() { | 390 void ResourceTracker::ClearSingletonOverride() { |
387 DCHECK(singleton_override_); | 391 DCHECK(singleton_override_); |
388 singleton_override_ = NULL; | 392 singleton_override_ = NULL; |
389 } | 393 } |
390 | 394 |
391 } // namespace ppapi | 395 } // namespace ppapi |
392 } // namespace webkit | 396 } // namespace webkit |
393 | 397 |
OLD | NEW |