Changeset 77874 in webkit
- Timestamp:
- Feb 7, 2011 5:44:49 PM (13 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r77870 r77874 1 2011-02-07 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Sam Weinig. 4 5 Crash in web process after the connection had been closed 6 https://bugs.webkit.org/show_bug.cgi?id=51115 7 <rdar://problem/8964255> 8 9 Remove didCloseOnConnectionWorkQueue from Connection::Client and add 10 Connection::setDidCloseOnConnectionWorkQueueCallback which takes a static 11 function, eliminating the race condition in connectionDidClose where m_client could be 12 nulled out in the client thread right before we try to dereference it. 13 14 * Platform/CoreIPC/Connection.cpp: 15 (CoreIPC::Connection::Connection): 16 Initialize m_didCloseOnConnectionWorkQueueCallback. 17 18 (CoreIPC::Connection::setDidCloseOnConnectionWorkQueueCallback): 19 Update m_didCloseOnConnectionWorkQueueCallback. 20 21 (CoreIPC::Connection::connectionDidClose): 22 Call m_didCloseOnConnectionWorkQueueCallback. 23 24 * Platform/WorkQueue.h: 25 Make WorkQueue noncopyable. 26 27 * PluginProcess/PluginProcess.cpp: 28 (WebKit::PluginProcess::initializeConnection): 29 Call setDidCloseOnConnectionWorkQueueCallback. 30 31 * Shared/ChildProcess.cpp: 32 (WebKit::ChildProcess::didCloseOnConnectionWorkQueue): 33 * Shared/ChildProcess.h: 34 didCloseOnConnectionWorkQueue is now a static member function. 35 36 * WebProcess/WebProcess.cpp: 37 (WebKit::WebProcess::initialize): 38 Call setDidCloseOnConnectionWorkQueueCallback. 39 1 40 2011-02-07 Enrica Casucci <enrica@apple.com> 2 41 -
trunk/Source/WebKit2/Platform/CoreIPC/Connection.cpp
r77258 r77874 50 50 , m_isServer(isServer) 51 51 , m_syncRequestID(0) 52 , m_didCloseOnConnectionWorkQueueCallback(0) 52 53 , m_isConnected(false) 53 54 , m_connectionQueue("com.apple.CoreIPC.ReceiveQueue") … … 67 68 68 69 m_connectionQueue.invalidate(); 70 } 71 72 void Connection::setDidCloseOnConnectionWorkQueueCallback(DidCloseOnConnectionWorkQueueCallback callback) 73 { 74 ASSERT(!m_isConnected); 75 76 m_didCloseOnConnectionWorkQueueCallback = callback; 69 77 } 70 78 … … 335 343 } 336 344 337 m_client->didCloseOnConnectionWorkQueue(&m_connectionQueue, this); 345 if (m_didCloseOnConnectionWorkQueueCallback) 346 m_didCloseOnConnectionWorkQueueCallback(m_connectionQueue, this); 338 347 339 348 m_clientRunLoop->scheduleWork(WorkItem::create(this, &Connection::dispatchConnectionDidClose)); -
trunk/Source/WebKit2/Platform/CoreIPC/Connection.h
r76507 r77874 86 86 virtual void didClose(Connection*) = 0; 87 87 virtual void didReceiveInvalidMessage(Connection*, MessageID) = 0; 88 89 // Called on the connection work queue when the connection is closed, before90 // didCall is called on the client thread.91 virtual void didCloseOnConnectionWorkQueue(WorkQueue*, Connection*) { }92 88 }; 93 89 … … 113 109 #endif 114 110 111 // The set callback will be called on the connection work queue when the connection is closed, 112 // before didCall is called on the client thread. Must be called before the connection is opened. 113 // In the future we might want a more generic way to handle sync or async messages directly 114 // on the work queue, for example if we want to handle them on some other thread we could avoid 115 // handling the message on the client thread first. 116 typedef void (*DidCloseOnConnectionWorkQueueCallback)(WorkQueue&, Connection*); 117 void setDidCloseOnConnectionWorkQueueCallback(DidCloseOnConnectionWorkQueueCallback callback); 118 115 119 bool open(); 116 120 void invalidate(); … … 195 199 uint64_t m_syncRequestID; 196 200 201 DidCloseOnConnectionWorkQueueCallback m_didCloseOnConnectionWorkQueueCallback; 202 197 203 bool m_isConnected; 198 204 WorkQueue m_connectionQueue; -
trunk/Source/WebKit2/Platform/WorkQueue.h
r76507 r77874 52 52 53 53 class WorkQueue { 54 WTF_MAKE_NONCOPYABLE(WorkQueue); 55 54 56 public: 55 57 explicit WorkQueue(const char* name); -
trunk/Source/WebKit2/PluginProcess/PluginProcess.cpp
r76916 r77874 62 62 63 63 m_connection = CoreIPC::Connection::createClientConnection(serverIdentifier, this, RunLoop::main()); 64 m_connection->setDidCloseOnConnectionWorkQueueCallback(didCloseOnConnectionWorkQueue); 64 65 m_connection->open(); 65 66 } -
trunk/Source/WebKit2/Shared/ChildProcess.cpp
r76916 r77874 49 49 } 50 50 51 void ChildProcess::didCloseOnConnectionWorkQueue(WorkQueue *workQueue, CoreIPC::Connection*)51 void ChildProcess::didCloseOnConnectionWorkQueue(WorkQueue& workQueue, CoreIPC::Connection*) 52 52 { 53 53 // If the connection has been closed and we haven't responded in the main thread for 10 seconds … … 55 55 static const double watchdogDelay = 10.0; 56 56 57 workQueue ->scheduleWorkAfterDelay(WorkItem::create(watchdogCallback), watchdogDelay);57 workQueue.scheduleWorkAfterDelay(WorkItem::create(watchdogCallback), watchdogDelay); 58 58 } 59 59 -
trunk/Source/WebKit2/Shared/ChildProcess.h
r76248 r77874 37 37 ~ChildProcess(); 38 38 39 private: 40 void didCloseOnConnectionWorkQueue(WorkQueue*, CoreIPC::Connection*); 39 static void didCloseOnConnectionWorkQueue(WorkQueue&, CoreIPC::Connection*); 41 40 }; 42 41 -
trunk/Source/WebKit2/WebProcess/WebProcess.cpp
r76916 r77874 128 128 129 129 m_connection = CoreIPC::Connection::createClientConnection(serverIdentifier, this, runLoop); 130 m_connection->setDidCloseOnConnectionWorkQueueCallback(didCloseOnConnectionWorkQueue); 131 130 132 m_connection->open(); 131 133
Note: See TracChangeset
for help on using the changeset viewer.