OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/glue/plugins/pepper_resource.h" | 5 #include "webkit/glue/plugins/pepper_resource.h" |
6 | 6 |
7 #include "third_party/ppapi/c/pp_resource.h" | 7 #include "third_party/ppapi/c/pp_resource.h" |
8 #include "webkit/glue/plugins/pepper_resource_tracker.h" | 8 #include "webkit/glue/plugins/pepper_resource_tracker.h" |
9 | 9 |
10 namespace pepper { | 10 namespace pepper { |
11 | 11 |
12 PP_Resource NullPPResource() { | |
13 PP_Resource ret = { 0 }; | |
14 return ret; | |
15 } | |
16 | |
17 Resource::Resource(PluginModule* module) : module_(module) { | 12 Resource::Resource(PluginModule* module) : module_(module) { |
18 ResourceTracker::Get()->AddResource(this); | 13 ResourceTracker::Get()->AddResource(this); |
19 } | 14 } |
20 | 15 |
21 Resource::~Resource() { | 16 Resource::~Resource() { |
22 ResourceTracker::Get()->DeleteResource(this); | 17 ResourceTracker::Get()->DeleteResource(this); |
23 } | 18 } |
24 | 19 |
25 PP_Resource Resource::GetResource() const { | 20 PP_Resource Resource::GetResource() const { |
26 PP_Resource ret; | 21 return reinterpret_cast<intptr_t>(this); |
27 ret.id = reinterpret_cast<intptr_t>(this); | |
28 return ret; | |
29 } | 22 } |
30 | 23 |
31 } // namespace pepper | 24 } // namespace pepper |
OLD | NEW |