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

Side by Side Diff: Source/bindings/modules/dart/custom/DartDeviceMotionEventCustom.cpp

Issue 817913005: Track some changes to reference types (mostly Blink types moving to Oilpan). (Closed) Base URL: svn://svn.chromium.org/blink/branches/dart/dartium
Patch Set: Created 5 years, 11 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 // Copyright 2011, Google Inc. 1 // Copyright 2011, Google Inc.
2 // All rights reserved. 2 // 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 are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 if (Dart_IsError(gotX)) { 53 if (Dart_IsError(gotX)) {
54 es = DartUtilities::errorToException(gotX); 54 es = DartUtilities::errorToException(gotX);
55 return; 55 return;
56 } 56 }
57 } 57 }
58 *canProvide = canProvideX; 58 *canProvide = canProvideX;
59 *contents = x; 59 *contents = x;
60 return; 60 return;
61 } 61 }
62 62
63 static RefPtr<DeviceMotionData::Acceleration> readAccelerationArgument(Dart_Hand le value, Dart_Handle& es) 63 static DeviceMotionData::Acceleration* readAccelerationArgument(Dart_Handle valu e, Dart_Handle& es)
64 { 64 {
65 if (Dart_IsNull(value)) 65 if (Dart_IsNull(value))
66 return nullptr; 66 return nullptr;
67 67
68 bool canProvideX; 68 bool canProvideX;
69 double x; 69 double x;
70 readDoubleField(value, "x", &canProvideX, &x, es); 70 readDoubleField(value, "x", &canProvideX, &x, es);
71 if (es) 71 if (es)
72 return nullptr; 72 return nullptr;
73 73
74 bool canProvideY; 74 bool canProvideY;
75 double y; 75 double y;
76 readDoubleField(value, "y", &canProvideY, &y, es); 76 readDoubleField(value, "y", &canProvideY, &y, es);
77 if (es) 77 if (es)
78 return nullptr; 78 return nullptr;
79 79
80 bool canProvideZ; 80 bool canProvideZ;
81 double z; 81 double z;
82 readDoubleField(value, "z", &canProvideZ, &z, es); 82 readDoubleField(value, "z", &canProvideZ, &z, es);
83 83
84 if (!canProvideX && !canProvideY && !canProvideZ) 84 if (!canProvideX && !canProvideY && !canProvideZ)
85 return nullptr; 85 return nullptr;
86 86
87 return DeviceMotionData::Acceleration::create(canProvideX, x, canProvideY, y , canProvideZ, z); 87 return DeviceMotionData::Acceleration::create(canProvideX, x, canProvideY, y , canProvideZ, z);
88 } 88 }
89 89
90 static RefPtr<DeviceMotionData::RotationRate> readRotationRateArgument(Dart_Hand le value, Dart_Handle& es) 90 static DeviceMotionData::RotationRate* readRotationRateArgument(Dart_Handle valu e, Dart_Handle& es)
91 { 91 {
92 if (Dart_IsNull(value)) 92 if (Dart_IsNull(value))
93 return nullptr; 93 return nullptr;
94 94
95 bool canProvideAlpha; 95 bool canProvideAlpha;
96 double alpha; 96 double alpha;
97 readDoubleField(value, "alpha", &canProvideAlpha, &alpha, es); 97 readDoubleField(value, "alpha", &canProvideAlpha, &alpha, es);
98 if (es) 98 if (es)
99 return nullptr; 99 return nullptr;
100 100
(...skipping 26 matching lines...) Expand all
127 goto fail; 127 goto fail;
128 128
129 bool bubbles = DartUtilities::dartToBool(args, 2, exception); 129 bool bubbles = DartUtilities::dartToBool(args, 2, exception);
130 if (exception) 130 if (exception)
131 goto fail; 131 goto fail;
132 132
133 bool cancelable = DartUtilities::dartToBool(args, 3, exception); 133 bool cancelable = DartUtilities::dartToBool(args, 3, exception);
134 if (exception) 134 if (exception)
135 goto fail; 135 goto fail;
136 136
137 RefPtr<DeviceMotionData::Acceleration> acceleration = 137 DeviceMotionData::Acceleration* acceleration =
138 readAccelerationArgument(Dart_GetNativeArgument(args, 4), exception) ; 138 readAccelerationArgument(Dart_GetNativeArgument(args, 4), exception) ;
139 if (exception) 139 if (exception)
140 goto fail; 140 goto fail;
141 141
142 RefPtr<DeviceMotionData::Acceleration> accelerationIncludingGravity = 142 DeviceMotionData::Acceleration* accelerationIncludingGravity =
143 readAccelerationArgument(Dart_GetNativeArgument(args, 5), exception) ; 143 readAccelerationArgument(Dart_GetNativeArgument(args, 5), exception) ;
144 if (exception) 144 if (exception)
145 goto fail; 145 goto fail;
146 146
147 RefPtr<DeviceMotionData::RotationRate> rotationRate = 147 DeviceMotionData::RotationRate* rotationRate =
148 readRotationRateArgument(Dart_GetNativeArgument(args, 6), exception) ; 148 readRotationRateArgument(Dart_GetNativeArgument(args, 6), exception) ;
149 if (exception) 149 if (exception)
150 goto fail; 150 goto fail;
151 151
152 bool intervalProvided = Dart_GetNativeArgumentCount(args) > 7; 152 bool intervalProvided = Dart_GetNativeArgumentCount(args) > 7;
153 double interval = (intervalProvided) 153 double interval = (intervalProvided)
154 ? DartUtilities::dartToDouble(Dart_GetNativeArgument(args, 7), excep tion) 154 ? DartUtilities::dartToDouble(Dart_GetNativeArgument(args, 7), excep tion)
155 : 0.0; 155 : 0.0;
156 if (exception) 156 if (exception)
157 goto fail; 157 goto fail;
158 158
159 RefPtr<DeviceMotionData> deviceMotionData = 159 DeviceMotionData* deviceMotionData =
160 DeviceMotionData::create(acceleration, accelerationIncludingGravity, 160 DeviceMotionData::create(acceleration, accelerationIncludingGravity,
161 rotationRate, intervalProvided, interval); 161 rotationRate, intervalProvided, interval);
162 imp->initDeviceMotionEvent(type, bubbles, cancelable, deviceMotionData.g et()); 162 imp->initDeviceMotionEvent(type, bubbles, cancelable, deviceMotionData);
163 return; 163 return;
164 } 164 }
165 165
166 fail: 166 fail:
167 Dart_ThrowException(exception); 167 Dart_ThrowException(exception);
168 ASSERT_NOT_REACHED(); 168 ASSERT_NOT_REACHED();
169 } 169 }
170 170
171 } 171 }
172 172
173 } 173 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698