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

Side by Side Diff: gpu/np_utils/np_dispatcher.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/np_dispatcher.h ('k') | gpu/np_utils/np_dispatcher_specializations.h » ('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/np_dispatcher.h"
6
7 namespace np_utils {
8
9 bool DispatcherHasMethodHelper(BaseNPDispatcher* chain,
10 NPObject* object,
11 NPIdentifier name) {
12 for (BaseNPDispatcher* dispatcher = chain;
13 dispatcher;
14 dispatcher = dispatcher->next()) {
15 if (dispatcher->name() == name) {
16 return true;
17 }
18 }
19
20 return false;
21 }
22
23 bool DispatcherInvokeHelper(BaseNPDispatcher* chain,
24 NPObject* object,
25 NPIdentifier name,
26 const NPVariant* args,
27 uint32_t num_args,
28 NPVariant* result) {
29 VOID_TO_NPVARIANT(*result);
30
31 for (BaseNPDispatcher* dispatcher = chain;
32 dispatcher;
33 dispatcher = dispatcher->next()) {
34 if (dispatcher->name() == name &&
35 dispatcher->num_args() == static_cast<int>(num_args)) {
36 if (dispatcher->Invoke(object, args, num_args, result))
37 return true;
38 }
39 }
40
41 return false;
42 }
43
44 bool DispatcherEnumerateHelper(BaseNPDispatcher* chain,
45 NPObject* object,
46 NPIdentifier** names,
47 uint32_t* num_names) {
48 // Count the number of names.
49 *num_names = 0;
50 for (BaseNPDispatcher* dispatcher = chain;
51 dispatcher;
52 dispatcher = dispatcher->next()) {
53 ++(*num_names);
54 }
55
56 // Copy names into the array.
57 *names = static_cast<NPIdentifier*>(
58 NPBrowser::get()->MemAlloc((*num_names) * sizeof(**names)));
59 int i = 0;
60 for (BaseNPDispatcher* dispatcher = chain;
61 dispatcher;
62 dispatcher = dispatcher->next()) {
63 (*names)[i] = dispatcher->name();
64 ++i;
65 }
66
67 return true;
68 }
69
70 BaseNPDispatcher::BaseNPDispatcher(BaseNPDispatcher* next, const NPUTF8* name)
71 : next_(next) {
72 // Convert first character to lower case if it is the ASCII range.
73 // TODO(apatrick): do this correctly for non-ASCII characters.
74 std::string java_script_style_name(name);
75 if (isupper(java_script_style_name[0])) {
76 java_script_style_name[0] = tolower(java_script_style_name[0]);
77 }
78
79 name_ = NPBrowser::get()->GetStringIdentifier(
80 java_script_style_name.c_str());
81 }
82
83 BaseNPDispatcher::~BaseNPDispatcher() {
84 }
85
86 } // namespace np_utils
OLDNEW
« no previous file with comments | « gpu/np_utils/np_dispatcher.h ('k') | gpu/np_utils/np_dispatcher_specializations.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698