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

Side by Side Diff: gpu/np_utils/np_dispatcher_specializations.h

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.cc ('k') | gpu/np_utils/np_headers.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 // There is deliberately no header guard here. This file is included multiple
6 // times, once for each dispatcher specialiation arity. Do not include this
7 // file directly. Include np_dispatcher.h instead.
8
9 template <typename NPObjectType PARAM_TYPENAMES>
10 class NPDispatcher<NPObjectType, void(PARAM_TYPES)>
11 : public BaseNPDispatcher {
12 typedef void (NPObjectType::*FunctionType)(PARAM_TYPES);
13 public:
14 NPDispatcher(BaseNPDispatcher* next,
15 const NPUTF8* name,
16 FunctionType function)
17 : BaseNPDispatcher(next, name),
18 function_(function) {
19 }
20
21 virtual bool Invoke(NPObject* object,
22 const NPVariant* args,
23 uint32_t num_args,
24 NPVariant* result) {
25 VOID_TO_NPVARIANT(*result);
26
27 if (num_args != NUM_PARAMS)
28 return false;
29
30 PARAM_TO_NVPARIANT_CONVERSIONS
31
32 (static_cast<NPObjectType*>(object)->*function_)(PARAM_NAMES);
33 return true;
34 }
35
36 virtual int num_args() const {
37 return NUM_PARAMS;
38 }
39
40 private:
41 FunctionType function_;
42 };
43
44 template <typename NPObjectType, typename R PARAM_TYPENAMES>
45 class NPDispatcher<NPObjectType, R(PARAM_TYPES)>
46 : public BaseNPDispatcher {
47 typedef R (NPObjectType::*FunctionType)(PARAM_TYPES);
48 public:
49 NPDispatcher(BaseNPDispatcher* next,
50 const NPUTF8* name,
51 FunctionType function)
52 : BaseNPDispatcher(next, name),
53 function_(function) {
54 }
55
56 virtual bool Invoke(NPObject* object,
57 const NPVariant* args,
58 uint32_t num_args,
59 NPVariant* result) {
60 VOID_TO_NPVARIANT(*result);
61
62 if (num_args != NUM_PARAMS)
63 return false;
64
65 PARAM_TO_NVPARIANT_CONVERSIONS
66
67 ValueToNPVariant(
68 (static_cast<NPObjectType*>(object)->*function_)(PARAM_NAMES), result);
69 return true;
70 }
71
72 virtual int num_args() const {
73 return NUM_PARAMS;
74 }
75
76 private:
77 FunctionType function_;
78 };
79
80 #undef NUM_PARAMS
81 #undef PARAM_TYPENAMES
82 #undef PARAM_TYPES
83 #undef PARAM_NAMES
84 #undef PARAM_DECLS
85 #undef PARAM_TO_NVPARIANT_CONVERSIONS
OLDNEW
« no previous file with comments | « gpu/np_utils/np_dispatcher.cc ('k') | gpu/np_utils/np_headers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698