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/function_group_base.h" | 14 #include "ppapi/shared_impl/function_group_base.h" |
15 #include "ppapi/shared_impl/id_assignment.h" | 15 #include "ppapi/shared_impl/id_assignment.h" |
16 #include "ppapi/shared_impl/tracker_base.h" | 16 #include "ppapi/shared_impl/tracker_base.h" |
17 #include "webkit/plugins/ppapi/npobject_var.h" | 17 #include "webkit/plugins/ppapi/npobject_var.h" |
18 #include "webkit/plugins/ppapi/plugin_module.h" | 18 #include "webkit/plugins/ppapi/plugin_module.h" |
19 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 19 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
20 #include "webkit/plugins/ppapi/ppb_char_set_impl.h" | 20 #include "webkit/plugins/ppapi/ppb_char_set_impl.h" |
21 #include "webkit/plugins/ppapi/ppb_cursor_control_impl.h" | 21 #include "webkit/plugins/ppapi/ppb_cursor_control_impl.h" |
22 #include "webkit/plugins/ppapi/ppb_find_impl.h" | 22 #include "webkit/plugins/ppapi/ppb_find_impl.h" |
23 #include "webkit/plugins/ppapi/ppb_font_impl.h" | 23 #include "webkit/plugins/ppapi/ppb_font_impl.h" |
24 #include "webkit/plugins/ppapi/resource.h" | |
25 #include "webkit/plugins/ppapi/resource_creation_impl.h" | 24 #include "webkit/plugins/ppapi/resource_creation_impl.h" |
26 | 25 |
27 using ppapi::CheckIdType; | 26 using ppapi::CheckIdType; |
28 using ppapi::MakeTypedId; | 27 using ppapi::MakeTypedId; |
29 using ppapi::NPObjectVar; | 28 using ppapi::NPObjectVar; |
30 using ppapi::PPIdType; | 29 using ppapi::PPIdType; |
31 using ppapi::Var; | 30 using ppapi::Var; |
32 | 31 |
33 namespace webkit { | 32 namespace webkit { |
34 namespace ppapi { | 33 namespace ppapi { |
(...skipping 23 matching lines...) Expand all Loading... |
58 | 57 |
59 // Lazily allocated function proxies for the different interfaces. | 58 // Lazily allocated function proxies for the different interfaces. |
60 scoped_ptr< ::ppapi::FunctionGroupBase > | 59 scoped_ptr< ::ppapi::FunctionGroupBase > |
61 function_proxies[::ppapi::proxy::INTERFACE_ID_COUNT]; | 60 function_proxies[::ppapi::proxy::INTERFACE_ID_COUNT]; |
62 }; | 61 }; |
63 | 62 |
64 // static | 63 // static |
65 ResourceTracker* ResourceTracker::global_tracker_ = NULL; | 64 ResourceTracker* ResourceTracker::global_tracker_ = NULL; |
66 ResourceTracker* ResourceTracker::singleton_override_ = NULL; | 65 ResourceTracker* ResourceTracker::singleton_override_ = NULL; |
67 | 66 |
68 ResourceTracker::ResourceTracker() | 67 ResourceTracker::ResourceTracker() { |
69 : last_resource_id_(0) { | |
70 // Wire up the new shared resource tracker base to use our implementation. | 68 // Wire up the new shared resource tracker base to use our implementation. |
71 ::ppapi::TrackerBase::Init(&GetTrackerBase); | 69 ::ppapi::TrackerBase::Init(&GetTrackerBase); |
72 } | 70 } |
73 | 71 |
74 ResourceTracker::~ResourceTracker() { | 72 ResourceTracker::~ResourceTracker() { |
75 } | 73 } |
76 | 74 |
77 // static | 75 // static |
78 ResourceTracker* ResourceTracker::Get() { | 76 ResourceTracker* ResourceTracker::Get() { |
79 if (singleton_override_) | 77 if (singleton_override_) |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 | 298 |
301 // static | 299 // static |
302 void ResourceTracker::ClearSingletonOverride() { | 300 void ResourceTracker::ClearSingletonOverride() { |
303 DCHECK(singleton_override_); | 301 DCHECK(singleton_override_); |
304 singleton_override_ = NULL; | 302 singleton_override_ = NULL; |
305 } | 303 } |
306 | 304 |
307 } // namespace ppapi | 305 } // namespace ppapi |
308 } // namespace webkit | 306 } // namespace webkit |
309 | 307 |
OLD | NEW |