Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Side by Side Diff: webkit/glue/plugins/pepper_resource_tracker.cc

Issue 1697008: New Pepper API implementation. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/glue/plugins/pepper_resource_tracker.h ('k') | webkit/glue/plugins/pepper_string.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "webkit/glue/plugins/pepper_resource_tracker.h"
6
7 #include <set>
8
9 #include "base/logging.h"
10 #include "third_party/ppapi/c/pp_resource.h"
11 #include "webkit/glue/plugins/pepper_resource.h"
12
13 namespace pepper {
14
15 ResourceTracker::ResourceTracker() {
16 }
17
18 ResourceTracker::~ResourceTracker() {
19 }
20
21 // static
22 ResourceTracker* ResourceTracker::Get() {
23 return Singleton<ResourceTracker>::get();
24 }
25
26 Resource* ResourceTracker::GetResource(PP_Resource res) const {
27 AutoLock lock(lock_);
28 Resource* resource = reinterpret_cast<Resource*>(res.id);
29 if (live_resources_.find(resource) == live_resources_.end())
30 return NULL;
31 return resource;
32 }
33
34 void ResourceTracker::AddResource(Resource* resource) {
35 AutoLock lock(lock_);
36 DCHECK(live_resources_.find(resource) == live_resources_.end());
37 live_resources_.insert(resource);
38 }
39
40 void ResourceTracker::DeleteResource(Resource* resource) {
41 AutoLock lock(lock_);
42 ResourceSet::iterator found = live_resources_.find(resource);
43 if (found == live_resources_.end()) {
44 NOTREACHED();
45 return;
46 }
47 live_resources_.erase(found);
48 }
49
50 } // namespace pepper
OLDNEW
« no previous file with comments | « webkit/glue/plugins/pepper_resource_tracker.h ('k') | webkit/glue/plugins/pepper_string.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698