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

Side by Side Diff: Source/bindings/v8/custom/V8GeolocationCustom.cpp

Issue 85263006: Make IDL Callbacks non-refcounted by default (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Patch for landing Created 7 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
OLDNEW
1 /* 1 /*
2 * Copyright 2009, The Android Open Source Project 2 * Copyright 2009, The Android Open Source Project
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 * * Redistributions of source code must retain the above copyright 7 * * 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 * * Redistributions in binary form must reproduce the above copyright 9 * * 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
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 } 122 }
123 } 123 }
124 124
125 return options.release(); 125 return options.release();
126 } 126 }
127 127
128 void V8Geolocation::getCurrentPositionMethodCustom(const v8::FunctionCallbackInf o<v8::Value>& info) 128 void V8Geolocation::getCurrentPositionMethodCustom(const v8::FunctionCallbackInf o<v8::Value>& info)
129 { 129 {
130 bool succeeded = false; 130 bool succeeded = false;
131 131
132 RefPtr<PositionCallback> positionCallback = createFunctionOnlyCallback<V8Pos itionCallback>(info[0], succeeded, info.GetIsolate()); 132 OwnPtr<PositionCallback> positionCallback = createFunctionOnlyCallback<V8Pos itionCallback>(info[0], succeeded, info.GetIsolate());
133 if (!succeeded) 133 if (!succeeded)
134 return; 134 return;
135 ASSERT(positionCallback); 135 ASSERT(positionCallback);
136 136
137 // Argument is optional (hence undefined is allowed), and null is allowed. 137 // Argument is optional (hence undefined is allowed), and null is allowed.
138 RefPtr<PositionErrorCallback> positionErrorCallback = createFunctionOnlyCall back<V8PositionErrorCallback>(info[1], succeeded, info.GetIsolate(), CallbackAll owUndefined | CallbackAllowNull); 138 OwnPtr<PositionErrorCallback> positionErrorCallback = createFunctionOnlyCall back<V8PositionErrorCallback>(info[1], succeeded, info.GetIsolate(), CallbackAll owUndefined | CallbackAllowNull);
139 if (!succeeded) 139 if (!succeeded)
140 return; 140 return;
141 141
142 RefPtr<PositionOptions> positionOptions = createPositionOptions(info[2], suc ceeded); 142 RefPtr<PositionOptions> positionOptions = createPositionOptions(info[2], suc ceeded);
143 if (!succeeded) 143 if (!succeeded)
144 return; 144 return;
145 ASSERT(positionOptions); 145 ASSERT(positionOptions);
146 146
147 Geolocation* geolocation = V8Geolocation::toNative(info.Holder()); 147 Geolocation* geolocation = V8Geolocation::toNative(info.Holder());
148 geolocation->getCurrentPosition(positionCallback.release(), positionErrorCal lback.release(), positionOptions.release()); 148 geolocation->getCurrentPosition(positionCallback.release(), positionErrorCal lback.release(), positionOptions.release());
149 } 149 }
150 150
151 void V8Geolocation::watchPositionMethodCustom(const v8::FunctionCallbackInfo<v8: :Value>& info) 151 void V8Geolocation::watchPositionMethodCustom(const v8::FunctionCallbackInfo<v8: :Value>& info)
152 { 152 {
153 bool succeeded = false; 153 bool succeeded = false;
154 154
155 RefPtr<PositionCallback> positionCallback = createFunctionOnlyCallback<V8Pos itionCallback>(info[0], succeeded, info.GetIsolate()); 155 OwnPtr<PositionCallback> positionCallback = createFunctionOnlyCallback<V8Pos itionCallback>(info[0], succeeded, info.GetIsolate());
156 if (!succeeded) 156 if (!succeeded)
157 return; 157 return;
158 ASSERT(positionCallback); 158 ASSERT(positionCallback);
159 159
160 // Argument is optional (hence undefined is allowed), and null is allowed. 160 // Argument is optional (hence undefined is allowed), and null is allowed.
161 RefPtr<PositionErrorCallback> positionErrorCallback = createFunctionOnlyCall back<V8PositionErrorCallback>(info[1], succeeded, info.GetIsolate(), CallbackAll owUndefined | CallbackAllowNull); 161 OwnPtr<PositionErrorCallback> positionErrorCallback = createFunctionOnlyCall back<V8PositionErrorCallback>(info[1], succeeded, info.GetIsolate(), CallbackAll owUndefined | CallbackAllowNull);
162 if (!succeeded) 162 if (!succeeded)
163 return; 163 return;
164 164
165 RefPtr<PositionOptions> positionOptions = createPositionOptions(info[2], suc ceeded); 165 RefPtr<PositionOptions> positionOptions = createPositionOptions(info[2], suc ceeded);
166 if (!succeeded) 166 if (!succeeded)
167 return; 167 return;
168 ASSERT(positionOptions); 168 ASSERT(positionOptions);
169 169
170 Geolocation* geolocation = V8Geolocation::toNative(info.Holder()); 170 Geolocation* geolocation = V8Geolocation::toNative(info.Holder());
171 int watchId = geolocation->watchPosition(positionCallback.release(), positio nErrorCallback.release(), positionOptions.release()); 171 int watchId = geolocation->watchPosition(positionCallback.release(), positio nErrorCallback.release(), positionOptions.release());
172 v8SetReturnValue(info, watchId); 172 v8SetReturnValue(info, watchId);
173 } 173 }
174 174
175 } // namespace WebCore 175 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8MutationCallback.h ('k') | Source/bindings/v8/custom/V8MutationObserverCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698