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

Side by Side Diff: Tools/DumpRenderTree/TestNetscapePlugIn/TestObject.cpp

Issue 20300002: Fix trailing whitespace in .cpp, .h, and .idl files (ex. Source/core) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #include "TestObject.h" 26 #include "TestObject.h"
27 #include "PluginObject.h" 27 #include "PluginObject.h"
28 28
29 #include <string.h> 29 #include <string.h>
30 #include <stdlib.h> 30 #include <stdlib.h>
31 31
32 static bool testEnumerate(NPObject *npobj, NPIdentifier **value, uint32_t *count ); 32 static bool testEnumerate(NPObject *npobj, NPIdentifier **value, uint32_t *count );
33 static bool testHasMethod(NPObject*, NPIdentifier name); 33 static bool testHasMethod(NPObject*, NPIdentifier name);
34 static bool testInvoke(NPObject*, NPIdentifier name, const NPVariant* args, uint 32_t argCount, NPVariant* result); 34 static bool testInvoke(NPObject*, NPIdentifier name, const NPVariant* args, uint 32_t argCount, NPVariant* result);
35 static bool testHasProperty(NPObject*, NPIdentifier name); 35 static bool testHasProperty(NPObject*, NPIdentifier name);
36 static bool testGetProperty(NPObject*, NPIdentifier name, NPVariant*); 36 static bool testGetProperty(NPObject*, NPIdentifier name, NPVariant*);
37 static NPObject *testAllocate(NPP npp, NPClass *theClass); 37 static NPObject *testAllocate(NPP npp, NPClass *theClass);
38 static void testDeallocate(NPObject *obj); 38 static void testDeallocate(NPObject *obj);
39 static bool testConstruct(NPObject* obj, const NPVariant* args, uint32_t argCoun t, NPVariant* result); 39 static bool testConstruct(NPObject* obj, const NPVariant* args, uint32_t argCoun t, NPVariant* result);
40 40
41 static NPClass testClass = { 41 static NPClass testClass = {
42 NP_CLASS_STRUCT_VERSION, 42 NP_CLASS_STRUCT_VERSION,
43 testAllocate, 43 testAllocate,
44 testDeallocate, 44 testDeallocate,
45 0, 45 0,
46 testHasMethod, 46 testHasMethod,
47 testInvoke, 47 testInvoke,
48 0, 48 0,
49 testHasProperty, 49 testHasProperty,
50 testGetProperty, 50 testGetProperty,
51 0, 51 0,
52 0, 52 0,
53 testEnumerate, 53 testEnumerate,
54 testConstruct 54 testConstruct
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 ++testObjectCount; 114 ++testObjectCount;
115 115
116 if (!identifiersInitialized) { 116 if (!identifiersInitialized) {
117 identifiersInitialized = true; 117 identifiersInitialized = true;
118 initializeIdentifiers(); 118 initializeIdentifiers();
119 } 119 }
120 120
121 return reinterpret_cast<NPObject*>(newInstance); 121 return reinterpret_cast<NPObject*>(newInstance);
122 } 122 }
123 123
124 static void testDeallocate(NPObject *obj) 124 static void testDeallocate(NPObject *obj)
125 { 125 {
126 TestObject* testObject = reinterpret_cast<TestObject*>(obj); 126 TestObject* testObject = reinterpret_cast<TestObject*>(obj);
127 if (testObject->testObject) 127 if (testObject->testObject)
128 browser->releaseobject(testObject->testObject); 128 browser->releaseobject(testObject->testObject);
129 129
130 --testObjectCount; 130 --testObjectCount;
131 free(obj); 131 free(obj);
132 } 132 }
133 133
134 static bool testHasMethod(NPObject*, NPIdentifier name) 134 static bool testHasMethod(NPObject*, NPIdentifier name)
(...skipping 13 matching lines...) Expand all
148 } 148 }
149 return false; 149 return false;
150 } 150 }
151 151
152 static bool testHasProperty(NPObject*, NPIdentifier name) 152 static bool testHasProperty(NPObject*, NPIdentifier name)
153 { 153 {
154 for (unsigned i = 0; i < NUM_TEST_IDENTIFIERS; i++) { 154 for (unsigned i = 0; i < NUM_TEST_IDENTIFIERS; i++) {
155 if (testIdentifiers[i] == name) 155 if (testIdentifiers[i] == name)
156 return true; 156 return true;
157 } 157 }
158 158
159 return false; 159 return false;
160 } 160 }
161 161
162 static bool testGetProperty(NPObject* npobj, NPIdentifier name, NPVariant* resul t) 162 static bool testGetProperty(NPObject* npobj, NPIdentifier name, NPVariant* resul t)
163 { 163 {
164 if (name == testIdentifiers[ID_PROPERTY_FOO]) { 164 if (name == testIdentifiers[ID_PROPERTY_FOO]) {
165 char* mem = static_cast<char*>(browser->memalloc(4)); 165 char* mem = static_cast<char*>(browser->memalloc(4));
166 strcpy(mem, "foo"); 166 strcpy(mem, "foo");
167 STRINGZ_TO_NPVARIANT(mem, *result); 167 STRINGZ_TO_NPVARIANT(mem, *result);
168 return true; 168 return true;
169 } 169 }
170 if (name == testIdentifiers[ID_PROPERTY_OBJECT_POINTER]) { 170 if (name == testIdentifiers[ID_PROPERTY_OBJECT_POINTER]) {
171 int32_t objectPointer = static_cast<int32_t>(reinterpret_cast<long long> (npobj)); 171 int32_t objectPointer = static_cast<int32_t>(reinterpret_cast<long long> (npobj));
172 172
173 INT32_TO_NPVARIANT(objectPointer, *result); 173 INT32_TO_NPVARIANT(objectPointer, *result);
174 return true; 174 return true;
175 } 175 }
176 if (name == testIdentifiers[ID_PROPERTY_TEST_OBJECT]) { 176 if (name == testIdentifiers[ID_PROPERTY_TEST_OBJECT]) {
177 TestObject* testObject = reinterpret_cast<TestObject*>(npobj); 177 TestObject* testObject = reinterpret_cast<TestObject*>(npobj);
178 if (!testObject->testObject) 178 if (!testObject->testObject)
179 testObject->testObject = browser->createobject(0, &testClass); 179 testObject->testObject = browser->createobject(0, &testClass);
180 browser->retainobject(testObject->testObject); 180 browser->retainobject(testObject->testObject);
181 OBJECT_TO_NPVARIANT(testObject->testObject, *result); 181 OBJECT_TO_NPVARIANT(testObject->testObject, *result);
182 return true; 182 return true;
183 } 183 }
184 if (name == testIdentifiers[ID_PROPERTY_REF_COUNT]) { 184 if (name == testIdentifiers[ID_PROPERTY_REF_COUNT]) {
185 INT32_TO_NPVARIANT(npobj->referenceCount, *result); 185 INT32_TO_NPVARIANT(npobj->referenceCount, *result);
186 return true; 186 return true;
187 } 187 }
188 188
189 return false; 189 return false;
190 } 190 }
191 191
192 static bool testEnumerate(NPObject* /*npobj*/, NPIdentifier **value, uint32_t *c ount) 192 static bool testEnumerate(NPObject* /*npobj*/, NPIdentifier **value, uint32_t *c ount)
193 { 193 {
194 *count = NUM_ENUMERATABLE_TEST_IDENTIFIERS; 194 *count = NUM_ENUMERATABLE_TEST_IDENTIFIERS;
195 195
196 *value = (NPIdentifier*)browser->memalloc(NUM_ENUMERATABLE_TEST_IDENTIFIERS * sizeof(NPIdentifier)); 196 *value = (NPIdentifier*)browser->memalloc(NUM_ENUMERATABLE_TEST_IDENTIFIERS * sizeof(NPIdentifier));
197 memcpy(*value, testIdentifiers, sizeof(NPIdentifier) * NUM_ENUMERATABLE_TEST _IDENTIFIERS); 197 memcpy(*value, testIdentifiers, sizeof(NPIdentifier) * NUM_ENUMERATABLE_TEST _IDENTIFIERS);
198 198
199 return true; 199 return true;
200 } 200 }
201 201
202 static bool testConstruct(NPObject* npobj, const NPVariant* /*args*/, uint32_t / *argCount*/, NPVariant* result) 202 static bool testConstruct(NPObject* npobj, const NPVariant* /*args*/, uint32_t / *argCount*/, NPVariant* result)
203 { 203 {
204 browser->retainobject(npobj); 204 browser->retainobject(npobj);
205 205
206 // Just return the same object. 206 // Just return the same object.
207 OBJECT_TO_NPVARIANT(npobj, *result); 207 OBJECT_TO_NPVARIANT(npobj, *result);
208 return true; 208 return true;
209 } 209 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698