private ListenerWrapper(VoidBlock2<String, NSError> callback, long contextInfo) { this.callback = callback; synchronized (callbacks) { callbacks.put(contextInfo, this); } } @TypeEncoding("v@:@:^v")
private static long create(OnUpdateListener listener) { if (listener == null) { throw new NullPointerException("listener"); } ListenerWrapper l = new ListenerWrapper(listener); long result = create(l, handleUpdate); CADisplayLink.listeners.put(result, l); return result; } /*<properties>*/
/** * @since Available in iOS 3.2 and later. */ public List<CTFontDescriptor> getMatchingFontDescriptorsSorted(SortCallback sortCallback) { long refconId = CTFontCollection.refconId.getAndIncrement(); synchronized (sortCallbacks) { sortCallbacks.put(refconId, sortCallback); } return getMatchingFontDescriptorsSorted(new FunctionPtr(cbSort), refconId); } /*<methods>*/
public void registerExternalChangeCallback(ExternalChangeCallback callback) { long refconId = ABAddressBook.changeCallbackId.getAndIncrement(); registerExternalChangeCallback(new FunctionPtr(cbExternalChange), refconId); synchronized (externalChangeCallbacks) { externalChangeCallbacks.put(refconId, callback); } } public void unregisterExternalChangeCallback(ExternalChangeCallback callback) {
public void setCallback(String name, OperatorCallback callback) { if (localInfoId == -1) { localInfoId = CGPDFOperatorTable.infoId.getAndIncrement(); } setCallback(name, new FunctionPtr(cbOperator)); synchronized (callbacks) { callbacks.put(localInfoId, callback); } } /*<methods>*/
private static void setPeerObject(long handle, ObjCObject o) { synchronized (objcBridgeLock) { if (o == null) { peers.remove(handle); } else { peers.put(handle, new ObjCObjectRef(o)); } } }
public void setInputSamplesInOutputCallback(AUInputSamplesInOutputCallback callback, AUScope scope) throws OSStatusException { long cid = callbackId.getAndIncrement(); AUInputSamplesInOutputCallbackStruct struct = new AUInputSamplesInOutputCallbackStruct(new FunctionPtr(cbInputSamplesInOutput), cid); setProperty(AUGenericProperty.InputSamplesInOutput, struct, scope); synchronized (isioCallbacks) { isioCallbacks.put(cid, callback); } } public void scheduleAudioSlice(AUScheduledAudioSlice slice, AUScope scope) throws OSStatusException {
public void addObserver(CFType observer, NotificationCallback callBack, String name, CFType object, CFNotificationSuspensionBehavior suspensionBehavior) { synchronized(callbacks) { long id = getCallbackIdForNotification(observer, name, object); callbacks.put(id, callBack); } addObserver(observer, new FunctionPtr(cbNotification), name, object, suspensionBehavior); }
public boolean setClientCallback(CFStreamEventType streamEvents, ClientCallback callback) { localRefconId = refconId.getAndIncrement(); CFStreamClientContext context = new CFStreamClientContext(); context.setInfo(localRefconId); boolean result = setClient(streamEvents, new FunctionPtr(cbClient), context); if (result) { synchronized (clientCallbacks) { clientCallbacks.put(localRefconId, callback); } } return result; }
public void setRenderCallback(AURenderCallback callback, AUScope scope) throws OSStatusException { long cid = callbackId.getAndIncrement(); AURenderCallbackStruct struct = new AURenderCallbackStruct(new FunctionPtr(cbRender), cid); setProperty(AUGenericProperty.SetRenderCallback, struct, scope); synchronized (renderCallbacks) { renderCallbacks.put(cid, callback); } } public void setHostCallback(AUHostCallback callback, AUScope scope) throws OSStatusException {
public static CFSocket createConnectedToSocketSignature(CFAllocator allocator, CFSocketSignature signature, CFSocketCallBackType callBackTypes, CFSocketCallback callback, double timeout) { long refconId = CFSocket.refconId.getAndIncrement(); CFSocketContext context = new CFSocketContext(); context.setInfo(refconId); CFSocket result = createConnectedToSocketSignature(allocator, signature, callBackTypes, new FunctionPtr(cbInvoke), context, timeout); if (result != null) { synchronized (callbacks) { callbacks.put(refconId, callback); } } return result; }
public UIMenuItem(String title, OnActionListener action) { super((SkipInit) null); if (action == null) { throw new NullPointerException("action"); } this.actionListener = action; Selector sel = getUniqueSelector(); initObject(init(title, sel)); synchronized (items) { items.put(sel.getHandle(), this); } }
public boolean setClientCallback(CFStreamEventType streamEvents, ClientCallback callback) { localRefconId = refconId.getAndIncrement(); CFStreamClientContext context = new CFStreamClientContext(); context.setInfo(localRefconId); boolean result = setClient(streamEvents, new FunctionPtr(cbClient), context); if (result) { synchronized (clientCallbacks) { clientCallbacks.put(localRefconId, callback); } } return result; }
/** * @since Available in iOS 2.0 and later. */ public void setCallback(ClientCallback callback) { CFHostClientContext context = new CFHostClientContext(); context.setInfo(localRefconId); synchronized (callbacks) { callbacks.put(localRefconId, callback); } setCallback(new FunctionPtr(cbInvoke), context); } /**
/** * @since Available in iOS 2.0 and later. */ public void setCallback(ClientCallback callback) { CFNetServiceClientContext context = new CFNetServiceClientContext(); context.setInfo(localRefconId); synchronized (callbacks) { callbacks.put(localRefconId, callback); } setCallback(new FunctionPtr(cbInvoke), context); } /**
/** * @since Available in iOS 2.0 and later. */ public boolean setCallback(ClientCallback callback) { SCNetworkReachabilityContext context = new SCNetworkReachabilityContext(); context.setInfo(localRefconId); synchronized (callbacks) { callbacks.put(localRefconId, callback); } return setCallback(new FunctionPtr(cbInvoke), context); } /*<methods>*/
private static void removePeerObject(ObjCObject o) { synchronized (objcBridgeLock) { long handle = o.getHandle(); ObjCObjectRef ref = peers.remove(handle); ObjCObject p = ref != null ? ref.get() : null; if (p != null && o != p) { // Not the same peer. Put it back. peers.put(handle, new ObjCObjectRef(p)); } } }
public CVPixelFormatDescription setFillExtendedPixelsCallback(FillExtendedPixelsCallback callback) { if (refcon == -1) { refcon = CVPixelFormatDescription.refconId.getAndIncrement(); } CVFillExtendedPixelsCallBackData data = new CVFillExtendedPixelsCallBackData(1, new FunctionPtr(cbFillExtendedPixels), refcon); NSData val = new NSData(data); set(Keys.FillExtendedPixelsCallback(), val); synchronized (callbacks) { callbacks.put(refcon, callback); } return this; }
public CTRunDelegate() { CTRunDelegateCallbacks callbacks = new CTRunDelegateCallbacks(); callbacks.setGetAscent(new FunctionPtr(cbGetAscent)); callbacks.setGetDescent(new FunctionPtr(cbGetDescent)); callbacks.setGetWidth(new FunctionPtr(cbGetWidth)); long refconId = CTRunDelegate.refconId.getAndIncrement(); delegate = CTRunDelegateIntern.create(callbacks, refconId); synchronized(runCallbacks) { runCallbacks.put(refconId, this); } } /*<constructors>*//*</constructors>*/
public void setHostCallback(AUHostCallback callback, AUScope scope) throws OSStatusException { long cid = callbackId.getAndIncrement(); AUHostCallbackInfo struct = new AUHostCallbackInfo(cid, new FunctionPtr(cbHostGetBeatAndTempo), new FunctionPtr(cbHostGetMusicalTimeLocation), new FunctionPtr(cbHostGetTransportState), new FunctionPtr(cbHostGetTransportState2)); setProperty(AUGenericProperty.HostCallbacks, struct, scope); synchronized (hostCallbacks) { hostCallbacks.put(cid, callback); } } public AUInputSamplesInOutputCallback getInputSamplesInOutputCallback(AUScope scope) throws OSStatusException {