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

Issue 111603006: Simplify invokeCallback() and support void return values for IDL callbacks (Closed)

Created:
7 years ago by adamk
Modified:
7 years ago
CC:
blink-reviews, shans, Michael van Ouwerkerk, eae+blinkwatch, yurys+blink_chromium.org, apavlov+blink_chromium.org, adamk+blink_chromium.org, loislo+blink_chromium.org, Steve Block, dino_apple.com, Nils Barth (inactive), caseq+blink_chromium.org, Nate Chapin, arv+blink, alancutter (OOO until 2018), marja+watch_chromium.org, dglazkov+blink, abarth-chromium, aandrey+blink_chromium.org, dstockwell, Timothy Loh, devtools-reviews_chromium.org, Raymond Toy, Eric Willigers, rjwright, lushnikov+blink_chromium.org, pfeldman+blink_chromium.org, kinuko, eustas+blink_chromium.org, tommyw+watchlist_chromium.org, paulirish+reviews_chromium.org, darktears, haraken, kojih, jsbell+bindings_chromium.org, alph+blink_chromium.org, vsevik+blink_chromium.org, Mike Lawther (Google), Inactive, watchdog-blink-watchlist_google.com
Visibility:
Public.

Description

Simplify invokeCallback() and support void return values for IDL callbacks Now that all callbacks are forced to be v8::Functions, invokeCallback() can be a lot simpler: no more need to look for a handleEvent method on a v8::Object. Only a single caller made use of the |callbackReturnValue|, so it's been removed and that caller now takes care of calling the callback. invokeCallback() is now just a TryCatch around ScriptController::callFunction. I also inverted the return value of invokeCallback: true means "everything went fine", false means "threw an exception". In making that change, it became clear that most callbacks don't actually have a return value (and their callers don't care what the called function returns), and were only using "boolean" in the IDL files because that was all the code generator supported. I've added support for "void", which is used everywhere except for a few cases in WebSQL. R=haraken@chromium.org, nbarth@chromium.org Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=163665

Patch Set 1 #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+133 lines, -129 lines) Patch
M Source/bindings/scripts/code_generator_v8.pm View 9 chunks +16 lines, -11 lines 0 comments Download
M Source/bindings/tests/idls/TestCallback.idl View 1 chunk +1 line, -0 lines 0 comments Download
M Source/bindings/tests/results/V8TestCallback.h View 2 chunks +4 lines, -3 lines 0 comments Download
M Source/bindings/tests/results/V8TestCallback.cpp View 8 chunks +26 lines, -15 lines 0 comments Download
M Source/bindings/v8/V8Callback.h View 1 chunk +3 lines, -2 lines 0 comments Download
M Source/bindings/v8/V8Callback.cpp View 1 chunk +5 lines, -21 lines 0 comments Download
M Source/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp View 2 chunks +9 lines, -3 lines 4 comments Download
M Source/bindings/v8/custom/V8SQLTransactionCustom.cpp View 2 chunks +2 lines, -2 lines 0 comments Download
M Source/core/css/CSSVariablesMapForEachCallback.h View 1 chunk +2 lines, -2 lines 0 comments Download
M Source/core/css/CSSVariablesMapForEachCallback.idl View 1 chunk +2 lines, -2 lines 0 comments Download
M Source/core/dom/RequestAnimationFrameCallback.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/core/dom/RequestAnimationFrameCallback.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/core/dom/StringCallback.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/core/dom/StringCallback.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/core/html/VoidCallback.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/core/html/VoidCallback.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/core/inspector/InspectorDatabaseAgent.cpp View 1 chunk +1 line, -1 line 0 comments Download
M Source/core/inspector/InspectorFileSystemAgent.cpp View 2 chunks +4 lines, -4 lines 0 comments Download
M Source/modules/filesystem/DOMFileSystem.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M Source/modules/filesystem/DOMFileSystemSync.cpp View 2 chunks +2 lines, -4 lines 0 comments Download
M Source/modules/filesystem/EntriesCallback.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/filesystem/EntriesCallback.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/filesystem/EntryCallback.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/filesystem/EntryCallback.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/filesystem/ErrorCallback.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/filesystem/ErrorCallback.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/filesystem/FileCallback.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/filesystem/FileCallback.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/filesystem/FileSystemCallback.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/filesystem/FileSystemCallback.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/filesystem/FileWriterBaseCallback.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/filesystem/FileWriterCallback.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/filesystem/FileWriterCallback.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/filesystem/MetadataCallback.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/filesystem/MetadataCallback.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/filesystem/SyncCallbackHelper.h View 2 chunks +3 lines, -6 lines 0 comments Download
M Source/modules/geolocation/PositionCallback.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/geolocation/PositionCallback.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/geolocation/PositionErrorCallback.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/geolocation/PositionErrorCallback.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/mediastream/MediaStreamTrackSourcesCallback.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/mediastream/MediaStreamTrackSourcesCallback.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/mediastream/NavigatorUserMediaErrorCallback.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/mediastream/NavigatorUserMediaErrorCallback.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/mediastream/NavigatorUserMediaSuccessCallback.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/mediastream/NavigatorUserMediaSuccessCallback.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/mediastream/RTCErrorCallback.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/mediastream/RTCErrorCallback.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/mediastream/RTCSessionDescriptionCallback.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/mediastream/RTCSessionDescriptionCallback.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/mediastream/RTCStatsCallback.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/mediastream/RTCStatsCallback.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/notifications/NotificationPermissionCallback.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/notifications/NotificationPermissionCallback.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/quota/StorageErrorCallback.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/quota/StorageErrorCallback.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/quota/StorageQuotaCallback.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/quota/StorageQuotaCallback.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/quota/StorageUsageCallback.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/quota/StorageUsageCallback.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/webaudio/AudioBufferCallback.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/webaudio/AudioBufferCallback.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/webmidi/MIDIErrorCallback.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/webmidi/MIDIErrorCallback.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/webmidi/MIDISuccessCallback.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/webmidi/MIDISuccessCallback.idl View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 5 (0 generated)
adamk
7 years ago (2013-12-11 00:44:15 UTC) #1
haraken
LGTM https://codereview.chromium.org/111603006/diff/1/Source/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp File Source/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp (right): https://codereview.chromium.org/111603006/diff/1/Source/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp#newcode72 Source/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp:72: v8::Handle<v8::Value> result = ScriptController::callFunction(executionContext(), m_callback.newLocal(isolate), isolate->GetCurrentContext()->Global(), 2, argv, ...
7 years ago (2013-12-11 00:54:29 UTC) #2
adamk
https://codereview.chromium.org/111603006/diff/1/Source/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp File Source/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp (right): https://codereview.chromium.org/111603006/diff/1/Source/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp#newcode72 Source/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp:72: v8::Handle<v8::Value> result = ScriptController::callFunction(executionContext(), m_callback.newLocal(isolate), isolate->GetCurrentContext()->Global(), 2, argv, isolate); ...
7 years ago (2013-12-11 01:05:48 UTC) #3
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/adamk@chromium.org/111603006/1
7 years ago (2013-12-11 01:12:29 UTC) #4
commit-bot: I haz the power
7 years ago (2013-12-11 02:25:22 UTC) #5
Message was sent while issue was closed.
Change committed as 163665

Powered by Google App Engine
This is Rietveld 408576698