Bug 55383

Summary: JavaInstance should be a pure interface
Product: WebKit Reporter: Steve Block <steveblock>
Component: WebCore Misc.Assignee: Steve Block <steveblock>
Status: RESOLVED FIXED    
Severity: Normal CC: andreip, dglazkov, jorlow, steveblock
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on: 55212, 55219, 55384, 55765, 55766, 55772, 55967, 56009, 56197, 57019, 57533    
Bug Blocks: 57230, 57859    
Attachments:
Description Flags
Patch 1
none
Patch 2 dglazkov: review+

Description Steve Block 2011-02-28 08:51:58 PST
The Java bridge code in WebCore/bridge/jni uses JavaInstance to represent a Java object which can be injected into JavaScript. The binding to JavaScript is done via NPAPI so objects of type JavaInstance are manipulated via JavaNPObject.

The implementation of JavaInstance is a simple wrapper around a JNI jobject. To allow implementations flexibility in how the binding to a Java object is achieved, JavaInstance should be an interface. The current JavaInstance implementation would be moved to a new JavaInstanceJobject class which implements this interface.
Comment 1 Steve Block 2011-04-04 04:12:21 PDT
Created attachment 88047 [details]
Patch 1
Comment 2 Andrei Popescu 2011-04-05 08:47:40 PDT
> Source/WebCore/bridge/jni/v8/JavaInstanceJobjectV8.cpp:45
> +    m_class = 0;

Can we use an initialization list instead?

> Source/WebCore/bridge/jni/v8/JavaInstanceJobjectV8.cpp:51
> +    delete m_class;

Use an OwnPtr?
Comment 3 Steve Block 2011-04-05 09:15:53 PDT
> Can we use an initialization list instead?
Done

> Use an OwnPtr?
Done
Comment 4 Steve Block 2011-04-05 09:16:16 PDT
Created attachment 88249 [details]
Patch 2
Comment 5 Andrei Popescu 2011-04-05 09:23:55 PDT
LGTM
Comment 6 Dimitri Glazkov (Google) 2011-04-05 09:44:53 PDT
Comment on attachment 88249 [details]
Patch 2

rs=me.
Comment 7 Steve Block 2011-04-05 10:12:16 PDT
Committed r82950: <http://trac.webkit.org/changeset/82950>