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

Side by Side Diff: gpu/np_utils/dynamic_np_object.cc

Issue 481007: Deleted np_utils library. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years 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 | « gpu/np_utils/dynamic_np_object.h ('k') | gpu/np_utils/dynamic_np_object_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2006-2008 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 "gpu/np_utils/dynamic_np_object.h"
6
7 namespace np_utils {
8
9 DynamicNPObject::DynamicNPObject(NPP npp) {
10 }
11
12 void DynamicNPObject::Invalidate() {
13 for (PropertyMap::iterator it = properties_.begin();
14 it != properties_.end();
15 ++it) {
16 it->second.Invalidate();
17 }
18 }
19
20 bool DynamicNPObject::HasProperty(NPIdentifier name) {
21 PropertyMap::iterator it = properties_.find(name);
22 return it != properties_.end();
23 }
24
25 bool DynamicNPObject::GetProperty(NPIdentifier name, NPVariant* result) {
26 PropertyMap::iterator it = properties_.find(name);
27 if (it == properties_.end())
28 return false;
29
30 it->second.CopyTo(result);
31 return true;
32 }
33
34 bool DynamicNPObject::SetProperty(NPIdentifier name, const NPVariant* value) {
35 properties_[name] = *value;
36 return true;
37 }
38
39 bool DynamicNPObject::RemoveProperty(NPIdentifier name) {
40 properties_.erase(name);
41 return false;
42 }
43
44 bool DynamicNPObject::Enumerate(NPIdentifier** names, uint32_t* count) {
45 *names = static_cast<NPIdentifier*>(
46 NPBrowser::get()->MemAlloc(properties_.size() * sizeof(*names)));
47 *count = properties_.size();
48
49 int i = 0;
50 for (PropertyMap::iterator it = properties_.begin();
51 it != properties_.end();
52 ++it) {
53 (*names)[i] = it->first;
54 ++i;
55 }
56
57 return true;
58 }
59 } // namespace np_utils
OLDNEW
« no previous file with comments | « gpu/np_utils/dynamic_np_object.h ('k') | gpu/np_utils/dynamic_np_object_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698