Changeset 71051 in webkit
- Timestamp:
- Nov 1, 2010 1:47:43 PM (14 years ago)
- Location:
- trunk/WebKit2
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit2/ChangeLog
r71048 r71051 1 2010-11-01 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Adam Roben. 4 5 Both the WebProcessConnection and PluginProcessConnection should have NPRemoteObjectMaps 6 https://bugs.webkit.org/show_bug.cgi?id=48775 7 8 * PluginProcess/PluginControllerProxy.cpp: 9 (WebKit::PluginControllerProxy::windowScriptNPObject): 10 Ask for an NPObjectProxy for the window script NPObject. 11 12 * PluginProcess/WebProcessConnection.cpp: 13 (WebKit::WebProcessConnection::WebProcessConnection): 14 Initialize m_npRemoteObjectMap. 15 16 * Shared/Plugins/NPObjectMessageReceiver.cpp: 17 (WebKit::NPObjectMessageReceiver::create): 18 Add a create member function that takes an NPObject. 19 20 (WebKit::NPObjectMessageReceiver::NPObjectMessageReceiver): 21 Retain the NPObject. 22 23 (WebKit::NPObjectMessageReceiver::~NPObjectMessageReceiver): 24 Release the NPObject. 25 26 * Shared/Plugins/NPRemoteObjectMap.cpp: 27 (WebKit::generateNPObjectID): 28 Generate a unique 64-bit NPObject ID. 29 30 (WebKit::NPRemoteObjectMap::getOrCreateNPObjectProxy): 31 Add stub. 32 33 (WebKit::NPRemoteObjectMap::registerNPObject): 34 Create a NPObjectMessageReceiver and add it to the map. 35 36 * WebKit2.xcodeproj/project.pbxproj: 37 Set the correct target for NPRuntime related files. 38 39 * WebProcess/Plugins/PluginProcessConnection.cpp: 40 (WebKit::PluginProcessConnection::PluginProcessConnection): 41 Initialize m_npRemoteObjectMap 42 43 * WebProcess/Plugins/PluginProxy.cpp: 44 (WebKit::PluginProxy::getWindowScriptNPObject): 45 Ask the real plug-in controller for the window script NPObject and register it. 46 1 47 2010-11-01 John Sullivan <sullivan@apple.com> 2 48 -
trunk/WebKit2/PluginProcess/PluginControllerProxy.cpp
r70927 r71051 30 30 #include "BackingStore.h" 31 31 #include "DataReference.h" 32 #include "NPObjectProxy.h" 32 33 #include "NetscapePlugin.h" 33 34 #include "NotImplemented.h" … … 170 171 return 0; 171 172 172 // FIXME: Do something with the windowScriptNPObjectID. 173 notImplemented(); 174 return 0; 173 return m_connection->npRemoteObjectMap().getOrCreateNPObjectProxy(windowScriptNPObjectID); 175 174 } 176 175 -
trunk/WebKit2/PluginProcess/WebProcessConnection.cpp
r68989 r71051 45 45 46 46 WebProcessConnection::WebProcessConnection(CoreIPC::Connection::Identifier connectionIdentifier) 47 : m_connection(CoreIPC::Connection::createServerConnection(connectionIdentifier, this, RunLoop::main())) 48 , m_npRemoteObjectMap(m_connection.get()) 47 49 { 48 m_connection = CoreIPC::Connection::createServerConnection(connectionIdentifier, this, RunLoop::main());49 50 m_connection->open(); 50 51 } -
trunk/WebKit2/PluginProcess/WebProcessConnection.h
r68989 r71051 30 30 31 31 #include "Connection.h" 32 #include "NPRemoteObjectMap.h" 32 33 #include "Plugin.h" 33 34 #include <wtf/RefCounted.h> … … 45 46 46 47 CoreIPC::Connection* connection() const { return m_connection.get(); } 48 49 NPRemoteObjectMap& npRemoteObjectMap() { return m_npRemoteObjectMap; } 47 50 48 51 private: … … 68 71 69 72 HashMap<uint64_t, PluginControllerProxy*> m_pluginControllers; 70 73 NPRemoteObjectMap m_npRemoteObjectMap; 71 74 }; 72 75 -
trunk/WebKit2/Shared/Plugins/NPObjectMessageReceiver.cpp
r70828 r71051 24 24 */ 25 25 26 #if ENABLE(PLUGIN_PROCESS) 27 26 28 #include "NPObjectMessageReceiver.h" 27 29 28 #i f ENABLE(PLUGIN_PROCESS)30 #include "NPRuntimeUtilities.h" 29 31 30 32 namespace WebKit { 31 33 32 NPObjectMessageReceiver::NPObjectMessageReceiver()34 PassOwnPtr<NPObjectMessageReceiver> NPObjectMessageReceiver::create(NPObject* npObject) 33 35 { 36 return adoptPtr(new NPObjectMessageReceiver(npObject)); 37 } 38 39 NPObjectMessageReceiver::NPObjectMessageReceiver(NPObject* npObject) 40 : m_npObject(npObject) 41 { 42 retainNPObject(m_npObject); 34 43 } 35 44 36 45 NPObjectMessageReceiver::~NPObjectMessageReceiver() 37 46 { 47 releaseNPObject(m_npObject); 38 48 } 39 49 -
trunk/WebKit2/Shared/Plugins/NPObjectMessageReceiver.h
r70828 r71051 29 29 #if ENABLE(PLUGIN_PROCESS) 30 30 31 #include <WebCore/npruntime.h> 31 32 #include <wtf/Noncopyable.h> 33 #include <wtf/PassOwnPtr.h> 32 34 33 35 namespace WebKit { … … 36 38 WTF_MAKE_NONCOPYABLE(NPObjectMessageReceiver); 37 39 40 public: 41 static PassOwnPtr<NPObjectMessageReceiver> create(NPObject* npObject); 42 ~NPObjectMessageReceiver(); 43 38 44 private: 39 NPObjectMessageReceiver(); 40 ~NPObjectMessageReceiver(); 45 explicit NPObjectMessageReceiver(NPObject* npObject); 46 47 NPObject* m_npObject; 41 48 }; 42 49 -
trunk/WebKit2/Shared/Plugins/NPRemoteObjectMap.cpp
r70802 r71051 28 28 #include "NPRemoteObjectMap.h" 29 29 30 #include "NPObjectMessageReceiver.h" 31 #include <wtf/OwnPtr.h> 32 30 33 namespace WebKit { 31 34 35 static uint64_t generateNPObjectID() 36 { 37 static uint64_t generateNPObjectID; 38 return ++generateNPObjectID; 39 } 40 32 41 NPRemoteObjectMap::NPRemoteObjectMap(CoreIPC::Connection* connection) 33 42 : m_connection(connection) … … 35 44 } 36 45 46 NPObjectProxy* NPRemoteObjectMap::getOrCreateNPObjectProxy(uint64_t remoteObjectID) 47 { 48 // FIXME: Implement. 49 return 0; 50 } 51 52 uint64_t NPRemoteObjectMap::registerNPObject(NPObject* npObject) 53 { 54 uint64_t npObjectID = generateNPObjectID(); 55 m_registeredNPObjects.set(npObjectID, NPObjectMessageReceiver::create(npObject).leakPtr()); 56 57 return npObjectID; 58 } 59 37 60 } // namespace WebKit 38 61 -
trunk/WebKit2/Shared/Plugins/NPRemoteObjectMap.h
r70802 r71051 29 29 #if ENABLE(PLUGIN_PROCESS) 30 30 31 #include <WebCore/npruntime.h> 32 #include <wtf/HashMap.h> 31 33 #include <wtf/Noncopyable.h> 32 34 … … 37 39 namespace WebKit { 38 40 41 class NPObjectMessageReceiver; 42 class NPObjectProxy; 43 39 44 class NPRemoteObjectMap { 40 45 WTF_MAKE_NONCOPYABLE(NPRemoteObjectMap); … … 43 48 explicit NPRemoteObjectMap(CoreIPC::Connection*); 44 49 50 // Creates an NPObjectProxy wrapper for the remote object with the given remote object ID. 51 NPObjectProxy* getOrCreateNPObjectProxy(uint64_t remoteObjectID); 52 53 // Expose the given NPObject as a remote object. Returns the objectID. 54 uint64_t registerNPObject(NPObject*); 55 45 56 private: 46 57 CoreIPC::Connection* m_connection; 58 59 // A map of NPObjectMessageReceiver classes, wrapping objects that we export to the 60 // other end of the connection. 61 HashMap<uint64_t, NPObjectMessageReceiver*> m_registeredNPObjects; 47 62 }; 48 63 -
trunk/WebKit2/WebKit2.xcodeproj/project.pbxproj
r71041 r71051 72 72 1A1C4EC810D06099005E67E7 /* WebCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1C79A100E7FC50078DEBC /* WebCore.framework */; }; 73 73 1A1C649B11F4174200553C19 /* WebContextMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A1C648611F415B700553C19 /* WebContextMac.mm */; }; 74 1A1FA253127A0E4F0050E709 /* NPRemoteObjectMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A1FA252127A0E4F0050E709 /* NPRemoteObjectMap.cpp */; };75 74 1A1FA285127A13BC0050E709 /* NPObjectProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A1FA284127A13BC0050E709 /* NPObjectProxy.cpp */; }; 76 75 1A1FA35D127A45BF0050E709 /* NPObjectMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A1FA35C127A45BF0050E709 /* NPObjectMessageReceiver.cpp */; }; … … 83 82 1A24BED5120894D100FBB059 /* SharedMemory.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A24BED3120894D100FBB059 /* SharedMemory.h */; }; 84 83 1A24BF3A120896A600FBB059 /* SharedMemoryMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A24BF39120896A600FBB059 /* SharedMemoryMac.cpp */; }; 84 1A2D82A4127F4EAB001EB962 /* NPObjectMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A1FA35C127A45BF0050E709 /* NPObjectMessageReceiver.cpp */; }; 85 1A2D82A5127F4EAB001EB962 /* NPObjectMessageReceiver.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A1FA35B127A45BF0050E709 /* NPObjectMessageReceiver.h */; }; 86 1A2D82A6127F4EAB001EB962 /* NPObjectProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A1FA284127A13BC0050E709 /* NPObjectProxy.cpp */; }; 87 1A2D82A7127F4EAB001EB962 /* NPObjectProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A1FA283127A13BC0050E709 /* NPObjectProxy.h */; }; 88 1A2D82A8127F4EAB001EB962 /* NPRemoteObjectMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A1FA252127A0E4F0050E709 /* NPRemoteObjectMap.cpp */; }; 89 1A2D82A9127F4EAB001EB962 /* NPRemoteObjectMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A1FA251127A0E4F0050E709 /* NPRemoteObjectMap.h */; }; 85 90 1A30066E1110F4F70031937C /* ResponsivenessTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A30066C1110F4F70031937C /* ResponsivenessTimer.h */; }; 86 91 1A30EAC6115D7DA30053E937 /* ConnectionMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A30EAC5115D7DA30053E937 /* ConnectionMac.cpp */; }; … … 2241 2246 1A119A95127B796200A9ECB1 /* MessageSender.h in Headers */, 2242 2247 51871B5C127CB89D00F76232 /* WebContextMenu.h in Headers */, 2248 1A2D82A5127F4EAB001EB962 /* NPObjectMessageReceiver.h in Headers */, 2249 1A2D82A7127F4EAB001EB962 /* NPObjectProxy.h in Headers */, 2250 1A2D82A9127F4EAB001EB962 /* NPRemoteObjectMap.h in Headers */, 2243 2251 ); 2244 2252 runOnlyForDeploymentPostprocessing = 0; … … 2354 2362 files = ( 2355 2363 1A6FA31111E3921E00DB1371 /* MainMac.cpp in Sources */, 2356 1A1FA253127A0E4F0050E709 /* NPRemoteObjectMap.cpp in Sources */,2357 2364 1A1FA285127A13BC0050E709 /* NPObjectProxy.cpp in Sources */, 2358 2365 1A1FA35D127A45BF0050E709 /* NPObjectMessageReceiver.cpp in Sources */, … … 2573 2580 51871B5B127CB89D00F76232 /* WebContextMenu.cpp in Sources */, 2574 2581 51A84CE3127F386B00CA6EA4 /* WebContextMenuProxy.cpp in Sources */, 2582 1A2D82A4127F4EAB001EB962 /* NPObjectMessageReceiver.cpp in Sources */, 2583 1A2D82A6127F4EAB001EB962 /* NPObjectProxy.cpp in Sources */, 2584 1A2D82A8127F4EAB001EB962 /* NPRemoteObjectMap.cpp in Sources */, 2575 2585 ); 2576 2586 runOnlyForDeploymentPostprocessing = 0; -
trunk/WebKit2/WebProcess/Plugins/PluginProcessConnection.cpp
r69973 r71051 37 37 : m_pluginProcessConnectionManager(pluginProcessConnectionManager) 38 38 , m_pluginPath(pluginPath) 39 , m_connection(CoreIPC::Connection::createClientConnection(connectionIdentifier, this, WebProcess::shared().runLoop())) 40 , m_npRemoteObjectMap(m_connection.get()) 39 41 { 40 m_connection = CoreIPC::Connection::createClientConnection(connectionIdentifier, this, WebProcess::shared().runLoop());41 42 m_connection->open(); 42 43 } … … 97 98 pluginProxy->pluginProcessCrashed(); 98 99 } 99 100 100 } 101 101 -
trunk/WebKit2/WebProcess/Plugins/PluginProcessConnection.h
r68989 r71051 30 30 31 31 #include "Connection.h" 32 #include "NPRemoteObjectMap.h" 32 33 #include "Plugin.h" 33 34 34 #include <wtf/RefCounted.h> 35 35 #include <wtf/text/WTFString.h> … … 57 57 void removePluginProxy(PluginProxy*); 58 58 59 NPRemoteObjectMap& npRemoteObjectMap() { return m_npRemoteObjectMap; } 60 59 61 private: 60 62 PluginProcessConnection(PluginProcessConnectionManager* pluginProcessConnectionManager, const String& pluginPath, CoreIPC::Connection::Identifier connectionIdentifier); … … 75 77 HashMap<uint64_t, PluginProxy*> m_plugins; 76 78 79 NPRemoteObjectMap m_npRemoteObjectMap; 77 80 }; 78 81 -
trunk/WebKit2/WebProcess/Plugins/PluginProxy.cpp
r70930 r71051 30 30 #include "BackingStore.h" 31 31 #include "DataReference.h" 32 #include "NPRuntimeUtilities.h" 32 33 #include "NotImplemented.h" 33 34 #include "PluginController.h" … … 348 349 void PluginProxy::getWindowScriptNPObject(uint64_t& windowScriptNPObjectID) 349 350 { 350 // FIXME: Actually get the window script object here. 351 windowScriptNPObjectID = 0; 351 NPObject* windowScriptNPObject = m_pluginController->windowScriptNPObject(); 352 if (!windowScriptNPObject) { 353 windowScriptNPObjectID = 0; 354 return; 355 } 356 357 windowScriptNPObjectID = m_connection->npRemoteObjectMap().registerNPObject(windowScriptNPObject); 358 releaseNPObject(windowScriptNPObject); 352 359 } 353 360
Note: See TracChangeset
for help on using the changeset viewer.