RESOLVED FIXED 113331
Web Inspector: Encapsulate SetEmbedderData/GetEmbedderData
https://bugs.webkit.org/show_bug.cgi?id=113331
Summary Web Inspector: Encapsulate SetEmbedderData/GetEmbedderData
johnjbarton
Reported 2013-03-26 12:07:35 PDT
We currently have two different sets of V8 embedder data. 1) V8PerContextData. This data is stored as a pointer on the context via SetAlignedPointerInEmbedderData. 2) A string like "page,232", stored on the context via SetEmbedderData, and used by the Inspector support binding code. Confusingly both systems index into the *same array* on the Context. Thus if you search the code base for SetEmbedderData it will appear that only index 0 is used. Using index 1 or 2 in SetEmbedder data leads to mysterious crashes, because in fact these indexes are used by the V8PerContextData and friends. The overall system would be less confusing and fragile of all uses this underlying array where together. (Using the V8PerContextData to store the Inspector value could be an extra step, but mixing the two kinds of data would be more confusing in my opinion). Patch ready.
Attachments
Patch (7.26 KB, patch)
2013-03-26 12:14 PDT, johnjbarton
no flags
Fix 2/2 issues from review in comment #2 (7.05 KB, patch)
2013-04-01 10:50 PDT, johnjbarton
no flags
Fix 1/1 issue from review in comment #4 (6.77 KB, patch)
2013-04-02 09:22 PDT, johnjbarton
no flags
johnjbarton
Comment 1 2013-03-26 12:14:47 PDT
Pavel Feldman
Comment 2 2013-03-30 02:11:45 PDT
Comment on attachment 195137 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=195137&action=review > Source/WebCore/bindings/v8/V8PerContextData.cpp:175 > + wanted = snprintf(buffer, sizeof(buffer), "%s", worldName); So you formatted the format above, but you don't actually need it here? Why formatting the format at all then? I.e. if (debugId == -1) snprintf(buffer, sizeof(buffer), "%s", worldName); else snprintf(buffer, sizeof(buffer), "%s,%d", worldName, debugId); sounds simpler. > Source/WebCore/bindings/v8/V8PerContextData.cpp:185 > +v8::Handle<v8::Value> V8PerContextDebugData::getDebugData(v8::Handle<v8::Context> context) No get prefixes in WebKit, simply debugData()
johnjbarton
Comment 3 2013-04-01 10:50:36 PDT
Created attachment 195992 [details] Fix 2/2 issues from review in comment #2
Adam Barth
Comment 4 2013-04-01 22:50:50 PDT
Comment on attachment 195992 [details] Fix 2/2 issues from review in comment #2 View in context: https://bugs.webkit.org/attachment.cgi?id=195992&action=review > Source/WebCore/bindings/v8/V8PerContextData.h:143 > + static v8::Handle<v8::Value> createDebugData(const char* worldName, int debugId); > + static v8::Handle<v8::Value> debugData(v8::Handle<v8::Context>); > + static void setDebugData(v8::Handle<v8::Context>, v8::Handle<v8::Value>); These can be file-level statics and don't need to be declared in the header file.
Pavel Feldman
Comment 5 2013-04-02 07:23:26 PDT
Comment on attachment 195992 [details] Fix 2/2 issues from review in comment #2 Looks good given Adam's comment is fixed. Clearing r?.
johnjbarton
Comment 6 2013-04-02 09:22:41 PDT
Created attachment 196159 [details] Fix 1/1 issue from review in comment #4
WebKit Review Bot
Comment 7 2013-04-02 11:34:05 PDT
Comment on attachment 196159 [details] Fix 1/1 issue from review in comment #4 Clearing flags on attachment: 196159 Committed r147475: <http://trac.webkit.org/changeset/147475>
WebKit Review Bot
Comment 8 2013-04-02 11:34:09 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.