Commit 583d51f6 authored by haraken@chromium.org's avatar haraken@chromium.org

Revert 174956 "Oilpan: Move ThreadableWebSocketChannelClientWrap..."

This CL broke worker-reload-repeated.html in oilpan bots.

> Oilpan: Move ThreadableWebSocketChannelClientWrapper to Oilpan's heap
> 
> This is a preparation for moving WebSocketChannelClient to the heap.
> 
> This CL adds a template specialization to CrossThreadCopier.h so that ThreadableWebSocketChannelClientWrapper* can be passed to createCallbackTask().
> 
> BUG=340522
> 
> Review URL: https://codereview.chromium.org/267323004

TBR=haraken@chromium.org

Review URL: https://codereview.chromium.org/309503013

git-svn-id: svn://svn.chromium.org/blink/trunk@175242 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 1e2aefdb
...@@ -57,14 +57,8 @@ template<typename T> struct CrossThreadTaskTraits<PassOwnPtr<T> > { ...@@ -57,14 +57,8 @@ template<typename T> struct CrossThreadTaskTraits<PassOwnPtr<T> > {
typedef PassOwnPtr<T> ParamType; typedef PassOwnPtr<T> ParamType;
}; };
// FIXME: Oilpan: Using a RawPtr is not safe.
// We need to move ExecutionContextTask to the heap and make this a Member.
template<typename T> struct CrossThreadTaskTraits<RawPtr<T> > {
typedef RawPtr<T> ParamType;
};
template<typename P1, typename MP1> template<typename P1, typename MP1>
class GC_PLUGIN_IGNORE("crbug.com/378192") CrossThreadTask1 : public ExecutionContextTask { class CrossThreadTask1 : public ExecutionContextTask {
public: public:
typedef void (*Method)(ExecutionContext*, MP1); typedef void (*Method)(ExecutionContext*, MP1);
typedef CrossThreadTask1<P1, MP1> CrossThreadTask; typedef CrossThreadTask1<P1, MP1> CrossThreadTask;
...@@ -93,7 +87,7 @@ private: ...@@ -93,7 +87,7 @@ private:
}; };
template<typename P1, typename MP1, typename P2, typename MP2> template<typename P1, typename MP1, typename P2, typename MP2>
class GC_PLUGIN_IGNORE("crbug.com/378192") CrossThreadTask2 : public ExecutionContextTask { class CrossThreadTask2 : public ExecutionContextTask {
public: public:
typedef void (*Method)(ExecutionContext*, MP1, MP2); typedef void (*Method)(ExecutionContext*, MP1, MP2);
typedef CrossThreadTask2<P1, MP1, P2, MP2> CrossThreadTask; typedef CrossThreadTask2<P1, MP1, P2, MP2> CrossThreadTask;
...@@ -125,7 +119,7 @@ private: ...@@ -125,7 +119,7 @@ private:
}; };
template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3> template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3>
class GC_PLUGIN_IGNORE("crbug.com/378192") CrossThreadTask3 : public ExecutionContextTask { class CrossThreadTask3 : public ExecutionContextTask {
public: public:
typedef void (*Method)(ExecutionContext*, MP1, MP2, MP3); typedef void (*Method)(ExecutionContext*, MP1, MP2, MP3);
typedef CrossThreadTask3<P1, MP1, P2, MP2, P3, MP3> CrossThreadTask; typedef CrossThreadTask3<P1, MP1, P2, MP2, P3, MP3> CrossThreadTask;
...@@ -160,7 +154,7 @@ private: ...@@ -160,7 +154,7 @@ private:
}; };
template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4> template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4>
class GC_PLUGIN_IGNORE("crbug.com/378192") CrossThreadTask4 : public ExecutionContextTask { class CrossThreadTask4 : public ExecutionContextTask {
public: public:
typedef void (*Method)(ExecutionContext*, MP1, MP2, MP3, MP4); typedef void (*Method)(ExecutionContext*, MP1, MP2, MP3, MP4);
typedef CrossThreadTask4<P1, MP1, P2, MP2, P3, MP3, P4, MP4> CrossThreadTask; typedef CrossThreadTask4<P1, MP1, P2, MP2, P3, MP3, P4, MP4> CrossThreadTask;
...@@ -198,7 +192,7 @@ private: ...@@ -198,7 +192,7 @@ private:
}; };
template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5> template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5>
class GC_PLUGIN_IGNORE("crbug.com/378192") CrossThreadTask5 : public ExecutionContextTask { class CrossThreadTask5 : public ExecutionContextTask {
public: public:
typedef void (*Method)(ExecutionContext*, MP1, MP2, MP3, MP4, MP5); typedef void (*Method)(ExecutionContext*, MP1, MP2, MP3, MP4, MP5);
typedef CrossThreadTask5<P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5> CrossThreadTask; typedef CrossThreadTask5<P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5> CrossThreadTask;
...@@ -239,7 +233,7 @@ private: ...@@ -239,7 +233,7 @@ private:
}; };
template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5, typename P6, typename MP6> template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5, typename P6, typename MP6>
class GC_PLUGIN_IGNORE("crbug.com/378192") CrossThreadTask6 : public ExecutionContextTask { class CrossThreadTask6 : public ExecutionContextTask {
public: public:
typedef void (*Method)(ExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6); typedef void (*Method)(ExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6);
typedef CrossThreadTask6<P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5, P6, MP6> CrossThreadTask; typedef CrossThreadTask6<P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5, P6, MP6> CrossThreadTask;
...@@ -283,7 +277,7 @@ private: ...@@ -283,7 +277,7 @@ private:
}; };
template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5, typename P6, typename MP6, typename P7, typename MP7> template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5, typename P6, typename MP6, typename P7, typename MP7>
class GC_PLUGIN_IGNORE("crbug.com/378192") CrossThreadTask7 : public ExecutionContextTask { class CrossThreadTask7 : public ExecutionContextTask {
public: public:
typedef void (*Method)(ExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6, MP7); typedef void (*Method)(ExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6, MP7);
typedef CrossThreadTask7<P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5, P6, MP6, P7, MP7> CrossThreadTask; typedef CrossThreadTask7<P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5, P6, MP6, P7, MP7> CrossThreadTask;
...@@ -330,7 +324,7 @@ private: ...@@ -330,7 +324,7 @@ private:
}; };
template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5, typename P6, typename MP6, typename P7, typename MP7, typename P8, typename MP8> template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5, typename P6, typename MP6, typename P7, typename MP7, typename P8, typename MP8>
class GC_PLUGIN_IGNORE("crbug.com/378192") CrossThreadTask8 : public ExecutionContextTask { class CrossThreadTask8 : public ExecutionContextTask {
public: public:
typedef void (*Method)(ExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6, MP7, MP8); typedef void (*Method)(ExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6, MP7, MP8);
typedef CrossThreadTask8<P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5, P6, MP6, P7, MP7, P8, MP8> CrossThreadTask; typedef CrossThreadTask8<P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5, P6, MP6, P7, MP7, P8, MP8> CrossThreadTask;
......
...@@ -45,13 +45,9 @@ ThreadableWebSocketChannelClientWrapper::ThreadableWebSocketChannelClientWrapper ...@@ -45,13 +45,9 @@ ThreadableWebSocketChannelClientWrapper::ThreadableWebSocketChannelClientWrapper
{ {
} }
ThreadableWebSocketChannelClientWrapper::~ThreadableWebSocketChannelClientWrapper() PassRefPtr<ThreadableWebSocketChannelClientWrapper> ThreadableWebSocketChannelClientWrapper::create(WebSocketChannelClient* client)
{ {
} return adoptRef(new ThreadableWebSocketChannelClientWrapper(client));
PassRefPtrWillBeRawPtr<ThreadableWebSocketChannelClientWrapper> ThreadableWebSocketChannelClientWrapper::create(WebSocketChannelClient* client)
{
return adoptRefWillBeNoop(new ThreadableWebSocketChannelClientWrapper(client));
} }
String ThreadableWebSocketChannelClientWrapper::subprotocol() const String ThreadableWebSocketChannelClientWrapper::subprotocol() const
...@@ -155,49 +151,49 @@ void ThreadableWebSocketChannelClientWrapper::processPendingTasks() ...@@ -155,49 +151,49 @@ void ThreadableWebSocketChannelClientWrapper::processPendingTasks()
(*iter)->performTask(0); (*iter)->performTask(0);
} }
void ThreadableWebSocketChannelClientWrapper::didConnectCallback(ExecutionContext* context, PassRefPtrWillBeRawPtr<ThreadableWebSocketChannelClientWrapper> wrapper) void ThreadableWebSocketChannelClientWrapper::didConnectCallback(ExecutionContext* context, PassRefPtr<ThreadableWebSocketChannelClientWrapper> wrapper)
{ {
ASSERT_UNUSED(context, !context); ASSERT_UNUSED(context, !context);
if (wrapper->m_client) if (wrapper->m_client)
wrapper->m_client->didConnect(); wrapper->m_client->didConnect();
} }
void ThreadableWebSocketChannelClientWrapper::didReceiveMessageCallback(ExecutionContext* context, PassRefPtrWillBeRawPtr<ThreadableWebSocketChannelClientWrapper> wrapper, const String& message) void ThreadableWebSocketChannelClientWrapper::didReceiveMessageCallback(ExecutionContext* context, PassRefPtr<ThreadableWebSocketChannelClientWrapper> wrapper, const String& message)
{ {
ASSERT_UNUSED(context, !context); ASSERT_UNUSED(context, !context);
if (wrapper->m_client) if (wrapper->m_client)
wrapper->m_client->didReceiveMessage(message); wrapper->m_client->didReceiveMessage(message);
} }
void ThreadableWebSocketChannelClientWrapper::didReceiveBinaryDataCallback(ExecutionContext* context, PassRefPtrWillBeRawPtr<ThreadableWebSocketChannelClientWrapper> wrapper, PassOwnPtr<Vector<char> > binaryData) void ThreadableWebSocketChannelClientWrapper::didReceiveBinaryDataCallback(ExecutionContext* context, PassRefPtr<ThreadableWebSocketChannelClientWrapper> wrapper, PassOwnPtr<Vector<char> > binaryData)
{ {
ASSERT_UNUSED(context, !context); ASSERT_UNUSED(context, !context);
if (wrapper->m_client) if (wrapper->m_client)
wrapper->m_client->didReceiveBinaryData(binaryData); wrapper->m_client->didReceiveBinaryData(binaryData);
} }
void ThreadableWebSocketChannelClientWrapper::didUpdateBufferedAmountCallback(ExecutionContext* context, PassRefPtrWillBeRawPtr<ThreadableWebSocketChannelClientWrapper> wrapper, unsigned long bufferedAmount) void ThreadableWebSocketChannelClientWrapper::didUpdateBufferedAmountCallback(ExecutionContext* context, PassRefPtr<ThreadableWebSocketChannelClientWrapper> wrapper, unsigned long bufferedAmount)
{ {
ASSERT_UNUSED(context, !context); ASSERT_UNUSED(context, !context);
if (wrapper->m_client) if (wrapper->m_client)
wrapper->m_client->didUpdateBufferedAmount(bufferedAmount); wrapper->m_client->didUpdateBufferedAmount(bufferedAmount);
} }
void ThreadableWebSocketChannelClientWrapper::didStartClosingHandshakeCallback(ExecutionContext* context, PassRefPtrWillBeRawPtr<ThreadableWebSocketChannelClientWrapper> wrapper) void ThreadableWebSocketChannelClientWrapper::didStartClosingHandshakeCallback(ExecutionContext* context, PassRefPtr<ThreadableWebSocketChannelClientWrapper> wrapper)
{ {
ASSERT_UNUSED(context, !context); ASSERT_UNUSED(context, !context);
if (wrapper->m_client) if (wrapper->m_client)
wrapper->m_client->didStartClosingHandshake(); wrapper->m_client->didStartClosingHandshake();
} }
void ThreadableWebSocketChannelClientWrapper::didCloseCallback(ExecutionContext* context, PassRefPtrWillBeRawPtr<ThreadableWebSocketChannelClientWrapper> wrapper, unsigned long unhandledBufferedAmount, WebSocketChannelClient::ClosingHandshakeCompletionStatus closingHandshakeCompletion, unsigned short code, const String& reason) void ThreadableWebSocketChannelClientWrapper::didCloseCallback(ExecutionContext* context, PassRefPtr<ThreadableWebSocketChannelClientWrapper> wrapper, unsigned long unhandledBufferedAmount, WebSocketChannelClient::ClosingHandshakeCompletionStatus closingHandshakeCompletion, unsigned short code, const String& reason)
{ {
ASSERT_UNUSED(context, !context); ASSERT_UNUSED(context, !context);
if (wrapper->m_client) if (wrapper->m_client)
wrapper->m_client->didClose(unhandledBufferedAmount, closingHandshakeCompletion, code, reason); wrapper->m_client->didClose(unhandledBufferedAmount, closingHandshakeCompletion, code, reason);
} }
void ThreadableWebSocketChannelClientWrapper::didReceiveMessageErrorCallback(ExecutionContext* context, PassRefPtrWillBeRawPtr<ThreadableWebSocketChannelClientWrapper> wrapper) void ThreadableWebSocketChannelClientWrapper::didReceiveMessageErrorCallback(ExecutionContext* context, PassRefPtr<ThreadableWebSocketChannelClientWrapper> wrapper)
{ {
ASSERT_UNUSED(context, !context); ASSERT_UNUSED(context, !context);
if (wrapper->m_client) if (wrapper->m_client)
......
...@@ -45,10 +45,9 @@ namespace WebCore { ...@@ -45,10 +45,9 @@ namespace WebCore {
class ExecutionContext; class ExecutionContext;
class WebSocketChannelClient; class WebSocketChannelClient;
class ThreadableWebSocketChannelClientWrapper : public ThreadSafeRefCountedWillBeGarbageCollectedFinalized<ThreadableWebSocketChannelClientWrapper> { class ThreadableWebSocketChannelClientWrapper : public ThreadSafeRefCounted<ThreadableWebSocketChannelClientWrapper> {
public: public:
static PassRefPtrWillBeRawPtr<ThreadableWebSocketChannelClientWrapper> create(WebSocketChannelClient*); static PassRefPtr<ThreadableWebSocketChannelClientWrapper> create(WebSocketChannelClient*);
~ThreadableWebSocketChannelClientWrapper();
// Subprotocol and extensions will be available when didConnect() callback is invoked. // Subprotocol and extensions will be available when didConnect() callback is invoked.
String subprotocol() const; String subprotocol() const;
...@@ -69,20 +68,18 @@ public: ...@@ -69,20 +68,18 @@ public:
void suspend(); void suspend();
void resume(); void resume();
void trace(Visitor*) { }
private: private:
ThreadableWebSocketChannelClientWrapper(WebSocketChannelClient*); ThreadableWebSocketChannelClientWrapper(WebSocketChannelClient*);
void processPendingTasks(); void processPendingTasks();
static void didConnectCallback(ExecutionContext*, PassRefPtrWillBeRawPtr<ThreadableWebSocketChannelClientWrapper>); static void didConnectCallback(ExecutionContext*, PassRefPtr<ThreadableWebSocketChannelClientWrapper>);
static void didReceiveMessageCallback(ExecutionContext*, PassRefPtrWillBeRawPtr<ThreadableWebSocketChannelClientWrapper>, const String& message); static void didReceiveMessageCallback(ExecutionContext*, PassRefPtr<ThreadableWebSocketChannelClientWrapper>, const String& message);
static void didReceiveBinaryDataCallback(ExecutionContext*, PassRefPtrWillBeRawPtr<ThreadableWebSocketChannelClientWrapper>, PassOwnPtr<Vector<char> >); static void didReceiveBinaryDataCallback(ExecutionContext*, PassRefPtr<ThreadableWebSocketChannelClientWrapper>, PassOwnPtr<Vector<char> >);
static void didUpdateBufferedAmountCallback(ExecutionContext*, PassRefPtrWillBeRawPtr<ThreadableWebSocketChannelClientWrapper>, unsigned long bufferedAmount); static void didUpdateBufferedAmountCallback(ExecutionContext*, PassRefPtr<ThreadableWebSocketChannelClientWrapper>, unsigned long bufferedAmount);
static void didStartClosingHandshakeCallback(ExecutionContext*, PassRefPtrWillBeRawPtr<ThreadableWebSocketChannelClientWrapper>); static void didStartClosingHandshakeCallback(ExecutionContext*, PassRefPtr<ThreadableWebSocketChannelClientWrapper>);
static void didCloseCallback(ExecutionContext*, PassRefPtrWillBeRawPtr<ThreadableWebSocketChannelClientWrapper>, unsigned long unhandledBufferedAmount, WebSocketChannelClient::ClosingHandshakeCompletionStatus, unsigned short code, const String& reason); static void didCloseCallback(ExecutionContext*, PassRefPtr<ThreadableWebSocketChannelClientWrapper>, unsigned long unhandledBufferedAmount, WebSocketChannelClient::ClosingHandshakeCompletionStatus, unsigned short code, const String& reason);
static void didReceiveMessageErrorCallback(ExecutionContext*, PassRefPtrWillBeRawPtr<ThreadableWebSocketChannelClientWrapper>); static void didReceiveMessageErrorCallback(ExecutionContext*, PassRefPtr<ThreadableWebSocketChannelClientWrapper>);
WebSocketChannelClient* m_client; WebSocketChannelClient* m_client;
// ThreadSafeRefCounted must not have String member variables. // ThreadSafeRefCounted must not have String member variables.
......
...@@ -90,8 +90,6 @@ public: ...@@ -90,8 +90,6 @@ public:
virtual void suspend() OVERRIDE; virtual void suspend() OVERRIDE;
virtual void resume() OVERRIDE; virtual void resume() OVERRIDE;
virtual void trace(Visitor*) OVERRIDE;
// Generated by the bridge. The Peer is destructed by an async call from // Generated by the bridge. The Peer is destructed by an async call from
// Bridge, and may outlive the bridge. All methods of this class must // Bridge, and may outlive the bridge. All methods of this class must
// be called on the main thread. // be called on the main thread.
...@@ -102,7 +100,7 @@ public: ...@@ -102,7 +100,7 @@ public:
// sourceURLAtConnection and lineNumberAtConnection parameters may // sourceURLAtConnection and lineNumberAtConnection parameters may
// be shown when the connection fails. // be shown when the connection fails.
static void initialize(ExecutionContext*, PassRefPtr<WeakReference<Peer> >, WorkerLoaderProxy*, PassRefPtrWillBeRawPtr<ThreadableWebSocketChannelClientWrapper>, const String& sourceURLAtConnection, unsigned lineNumberAtConnection, PassOwnPtr<ThreadableWebSocketChannelSyncHelper>); static void initialize(ExecutionContext*, PassRefPtr<WeakReference<Peer> >, WorkerLoaderProxy*, PassRefPtr<ThreadableWebSocketChannelClientWrapper>, const String& sourceURLAtConnection, unsigned lineNumberAtConnection, PassOwnPtr<ThreadableWebSocketChannelSyncHelper>);
void destroy(); void destroy();
void connect(const KURL&, const String& protocol); void connect(const KURL&, const String& protocol);
...@@ -126,9 +124,9 @@ public: ...@@ -126,9 +124,9 @@ public:
virtual void didReceiveMessageError() OVERRIDE; virtual void didReceiveMessageError() OVERRIDE;
private: private:
Peer(PassRefPtr<WeakReference<Peer> >, PassRefPtrWillBeRawPtr<ThreadableWebSocketChannelClientWrapper>, WorkerLoaderProxy&, ExecutionContext*, const String& sourceURL, unsigned lineNumber, PassOwnPtr<ThreadableWebSocketChannelSyncHelper>); Peer(PassRefPtr<WeakReference<Peer> >, PassRefPtr<ThreadableWebSocketChannelClientWrapper>, WorkerLoaderProxy&, ExecutionContext*, const String& sourceURL, unsigned lineNumber, PassOwnPtr<ThreadableWebSocketChannelSyncHelper>);
const RefPtrWillBePersistent<ThreadableWebSocketChannelClientWrapper> m_workerClientWrapper; const RefPtr<ThreadableWebSocketChannelClientWrapper> m_workerClientWrapper;
WorkerLoaderProxy& m_loaderProxy; WorkerLoaderProxy& m_loaderProxy;
RefPtrWillBePersistent<WebSocketChannel> m_mainWebSocketChannel; RefPtrWillBePersistent<WebSocketChannel> m_mainWebSocketChannel;
OwnPtr<ThreadableWebSocketChannelSyncHelper> m_syncHelper; OwnPtr<ThreadableWebSocketChannelSyncHelper> m_syncHelper;
...@@ -139,7 +137,7 @@ private: ...@@ -139,7 +137,7 @@ private:
// Bridge for Peer. Running on the worker thread. // Bridge for Peer. Running on the worker thread.
class Bridge : public RefCounted<Bridge> { class Bridge : public RefCounted<Bridge> {
public: public:
static PassRefPtr<Bridge> create(PassRefPtrWillBeRawPtr<ThreadableWebSocketChannelClientWrapper> workerClientWrapper, WorkerGlobalScope& workerGlobalScope) static PassRefPtr<Bridge> create(PassRefPtr<ThreadableWebSocketChannelClientWrapper> workerClientWrapper, WorkerGlobalScope& workerGlobalScope)
{ {
return adoptRef(new Bridge(workerClientWrapper, workerGlobalScope)); return adoptRef(new Bridge(workerClientWrapper, workerGlobalScope));
} }
...@@ -159,9 +157,9 @@ private: ...@@ -159,9 +157,9 @@ private:
void resume(); void resume();
private: private:
Bridge(PassRefPtrWillBeRawPtr<ThreadableWebSocketChannelClientWrapper>, WorkerGlobalScope&); Bridge(PassRefPtr<ThreadableWebSocketChannelClientWrapper>, WorkerGlobalScope&);
static void setWebSocketChannel(ExecutionContext*, Bridge* thisPtr, Peer*, PassRefPtrWillBeRawPtr<ThreadableWebSocketChannelClientWrapper>); static void setWebSocketChannel(ExecutionContext*, Bridge* thisPtr, Peer*, PassRefPtr<ThreadableWebSocketChannelClientWrapper>);
// Executed on the worker context's thread. // Executed on the worker context's thread.
void clearClientWrapper(); void clearClientWrapper();
...@@ -173,7 +171,7 @@ private: ...@@ -173,7 +171,7 @@ private:
bool hasTerminatedPeer() { return !m_syncHelper; } bool hasTerminatedPeer() { return !m_syncHelper; }
const RefPtrWillBePersistent<ThreadableWebSocketChannelClientWrapper> m_workerClientWrapper; const RefPtr<ThreadableWebSocketChannelClientWrapper> m_workerClientWrapper;
RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope; RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope;
WorkerLoaderProxy& m_loaderProxy; WorkerLoaderProxy& m_loaderProxy;
ThreadableWebSocketChannelSyncHelper* m_syncHelper; ThreadableWebSocketChannelSyncHelper* m_syncHelper;
...@@ -182,7 +180,7 @@ private: ...@@ -182,7 +180,7 @@ private:
WorkerThreadableWebSocketChannel(WorkerGlobalScope&, WebSocketChannelClient*, const String& sourceURL, unsigned lineNumber); WorkerThreadableWebSocketChannel(WorkerGlobalScope&, WebSocketChannelClient*, const String& sourceURL, unsigned lineNumber);
const RefPtrWillBeMember<ThreadableWebSocketChannelClientWrapper> m_workerClientWrapper; const RefPtr<ThreadableWebSocketChannelClientWrapper> m_workerClientWrapper;
RefPtr<Bridge> m_bridge; RefPtr<Bridge> m_bridge;
String m_sourceURLAtConnection; String m_sourceURLAtConnection;
unsigned m_lineNumberAtConnection; unsigned m_lineNumberAtConnection;
......
...@@ -40,27 +40,27 @@ ...@@ -40,27 +40,27 @@
namespace WebCore { namespace WebCore {
CrossThreadCopierBase<false, false, false, KURL>::Type CrossThreadCopierBase<false, false, false, KURL>::copy(const KURL& url) CrossThreadCopierBase<false, false, KURL>::Type CrossThreadCopierBase<false, false, KURL>::copy(const KURL& url)
{ {
return url.copy(); return url.copy();
} }
CrossThreadCopierBase<false, false, false, String>::Type CrossThreadCopierBase<false, false, false, String>::copy(const String& str) CrossThreadCopierBase<false, false, String>::Type CrossThreadCopierBase<false, false, String>::copy(const String& str)
{ {
return str.isolatedCopy(); return str.isolatedCopy();
} }
CrossThreadCopierBase<false, false, false, ResourceError>::Type CrossThreadCopierBase<false, false, false, ResourceError>::copy(const ResourceError& error) CrossThreadCopierBase<false, false, ResourceError>::Type CrossThreadCopierBase<false, false, ResourceError>::copy(const ResourceError& error)
{ {
return error.copy(); return error.copy();
} }
CrossThreadCopierBase<false, false, false, ResourceRequest>::Type CrossThreadCopierBase<false, false, false, ResourceRequest>::copy(const ResourceRequest& request) CrossThreadCopierBase<false, false, ResourceRequest>::Type CrossThreadCopierBase<false, false, ResourceRequest>::copy(const ResourceRequest& request)
{ {
return request.copyData(); return request.copyData();
} }
CrossThreadCopierBase<false, false, false, ResourceResponse>::Type CrossThreadCopierBase<false, false, false, ResourceResponse>::copy(const ResourceResponse& response) CrossThreadCopierBase<false, false, ResourceResponse>::Type CrossThreadCopierBase<false, false, ResourceResponse>::copy(const ResourceResponse& response)
{ {
return response.copyData(); return response.copyData();
} }
...@@ -89,7 +89,7 @@ COMPILE_ASSERT((WTF::IsSameType< ...@@ -89,7 +89,7 @@ COMPILE_ASSERT((WTF::IsSameType<
// Add a generic specialization which will let's us verify that no other template matches. // Add a generic specialization which will let's us verify that no other template matches.
template<typename T> struct CrossThreadCopierBase<false, false, false, T> { template<typename T> struct CrossThreadCopierBase<false, false, T> {
typedef int Type; typedef int Type;
}; };
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#define CrossThreadCopier_h #define CrossThreadCopier_h
#include "platform/PlatformExport.h" #include "platform/PlatformExport.h"
#include "platform/heap/Handle.h"
#include "wtf/Assertions.h" #include "wtf/Assertions.h"
#include "wtf/Forward.h" #include "wtf/Forward.h"
#include "wtf/PassOwnPtr.h" #include "wtf/PassOwnPtr.h"
...@@ -61,25 +60,25 @@ namespace WebCore { ...@@ -61,25 +60,25 @@ namespace WebCore {
} }
}; };
template<bool isConvertibleToInteger, bool isThreadSafeRefCounted, bool isGarbageCollected, typename T> struct CrossThreadCopierBase; template<bool isConvertibleToInteger, bool isThreadSafeRefCounted, typename T> struct CrossThreadCopierBase;
// Integers get passed through without any changes. // Integers get passed through without any changes.
template<typename T> struct CrossThreadCopierBase<true, false, false, T> : public CrossThreadCopierPassThrough<T> { template<typename T> struct CrossThreadCopierBase<true, false, T> : public CrossThreadCopierPassThrough<T> {
}; };
// To allow a type to be passed across threads using its copy constructor, add a forward declaration of the type and // To allow a type to be passed across threads using its copy constructor, add a forward declaration of the type and
// a CopyThreadCopierBase<false, false, TypeName> : public CrossThreadCopierPassThrough<TypeName> { }; to this file. // a CopyThreadCopierBase<false, false, TypeName> : public CrossThreadCopierPassThrough<TypeName> { }; to this file.
template<> struct CrossThreadCopierBase<false, false, false, ThreadableLoaderOptions> : public CrossThreadCopierPassThrough<ThreadableLoaderOptions> { template<> struct CrossThreadCopierBase<false, false, ThreadableLoaderOptions> : public CrossThreadCopierPassThrough<ThreadableLoaderOptions> {
}; };
template<> struct CrossThreadCopierBase<false, false, false, IntRect> : public CrossThreadCopierPassThrough<IntRect> { template<> struct CrossThreadCopierBase<false, false, IntRect> : public CrossThreadCopierPassThrough<IntRect> {
}; };
template<> struct CrossThreadCopierBase<false, false, false, IntSize> : public CrossThreadCopierPassThrough<IntSize> { template<> struct CrossThreadCopierBase<false, false, IntSize> : public CrossThreadCopierPassThrough<IntSize> {
}; };
// Custom copy methods. // Custom copy methods.
template<typename T> struct CrossThreadCopierBase<false, true, false, T> { template<typename T> struct CrossThreadCopierBase<false, true, T> {
typedef typename WTF::RemoveTemplate<T, RefPtr>::Type TypeWithoutRefPtr; typedef typename WTF::RemoveTemplate<T, RefPtr>::Type TypeWithoutRefPtr;
typedef typename WTF::RemoveTemplate<TypeWithoutRefPtr, PassRefPtr>::Type TypeWithoutPassRefPtr; typedef typename WTF::RemoveTemplate<TypeWithoutRefPtr, PassRefPtr>::Type TypeWithoutPassRefPtr;
typedef typename WTF::RemovePointer<TypeWithoutPassRefPtr>::Type RefCountedType; typedef typename WTF::RemovePointer<TypeWithoutPassRefPtr>::Type RefCountedType;
...@@ -97,7 +96,7 @@ namespace WebCore { ...@@ -97,7 +96,7 @@ namespace WebCore {
} }
}; };
template<typename T> struct CrossThreadCopierBase<false, false, false, PassOwnPtr<T> > { template<typename T> struct CrossThreadCopierBase<false, false, PassOwnPtr<T> > {
typedef PassOwnPtr<T> Type; typedef PassOwnPtr<T> Type;
static Type copy(Type ownPtr) static Type copy(Type ownPtr)
{ {
...@@ -105,46 +104,36 @@ namespace WebCore { ...@@ -105,46 +104,36 @@ namespace WebCore {
} }
}; };
template<> struct CrossThreadCopierBase<false, false, false, KURL> { template<> struct CrossThreadCopierBase<false, false, KURL> {
typedef KURL Type; typedef KURL Type;
PLATFORM_EXPORT static Type copy(const KURL&); PLATFORM_EXPORT static Type copy(const KURL&);
}; };
template<> struct CrossThreadCopierBase<false, false, false, String> { template<> struct CrossThreadCopierBase<false, false, String> {
typedef String Type; typedef String Type;
PLATFORM_EXPORT static Type copy(const String&); PLATFORM_EXPORT static Type copy(const String&);
}; };
template<> struct CrossThreadCopierBase<false, false, false, ResourceError> { template<> struct CrossThreadCopierBase<false, false, ResourceError> {
typedef ResourceError Type; typedef ResourceError Type;
PLATFORM_EXPORT static Type copy(const ResourceError&); PLATFORM_EXPORT static Type copy(const ResourceError&);
}; };
template<> struct CrossThreadCopierBase<false, false, false, ResourceRequest> { template<> struct CrossThreadCopierBase<false, false, ResourceRequest> {
typedef PassOwnPtr<CrossThreadResourceRequestData> Type; typedef PassOwnPtr<CrossThreadResourceRequestData> Type;
PLATFORM_EXPORT static Type copy(const ResourceRequest&); PLATFORM_EXPORT static Type copy(const ResourceRequest&);
}; };
template<> struct CrossThreadCopierBase<false, false, false, ResourceResponse> { template<> struct CrossThreadCopierBase<false, false, ResourceResponse> {
typedef PassOwnPtr<CrossThreadResourceResponseData> Type; typedef PassOwnPtr<CrossThreadResourceResponseData> Type;
PLATFORM_EXPORT static Type copy(const ResourceResponse&); PLATFORM_EXPORT static Type copy(const ResourceResponse&);
}; };
template<typename T> struct CrossThreadCopierBase<false, false, true, T> {
typedef typename WTF::RemovePointer<T>::Type TypeWithoutPointer;
typedef PassRefPtrWillBeRawPtr<TypeWithoutPointer> Type;
static Type copy(const T& ptr)
{
return ptr;
}
};
template<typename T> struct CrossThreadCopier : public CrossThreadCopierBase<WTF::IsConvertibleToInteger<T>::value, template<typename T> struct CrossThreadCopier : public CrossThreadCopierBase<WTF::IsConvertibleToInteger<T>::value,
WTF::IsSubclassOfTemplate<typename WTF::RemoveTemplate<T, RefPtr>::Type, ThreadSafeRefCounted>::value WTF::IsSubclassOfTemplate<typename WTF::RemoveTemplate<T, RefPtr>::Type, ThreadSafeRefCounted>::value
|| WTF::IsSubclassOfTemplate<typename WTF::RemovePointer<T>::Type, ThreadSafeRefCounted>::value || WTF::IsSubclassOfTemplate<typename WTF::RemovePointer<T>::Type, ThreadSafeRefCounted>::value
|| WTF::IsSubclassOfTemplate<typename WTF::RemoveTemplate<T, PassRefPtr>::Type, ThreadSafeRefCounted>::value, || WTF::IsSubclassOfTemplate<typename WTF::RemoveTemplate<T, PassRefPtr>::Type, ThreadSafeRefCounted>::value,
WTF::IsSubclassOfTemplate<typename WTF::RemovePointer<T>::Type, GarbageCollected>::value, T> {
T> {
}; };
template<typename T> struct AllowCrossThreadAccessWrapper { template<typename T> struct AllowCrossThreadAccessWrapper {
...@@ -155,7 +144,7 @@ namespace WebCore { ...@@ -155,7 +144,7 @@ namespace WebCore {
T* m_value; T* m_value;
}; };
template<typename T> struct CrossThreadCopierBase<false, false, false, AllowCrossThreadAccessWrapper<T> > { template<typename T> struct CrossThreadCopierBase<false, false, AllowCrossThreadAccessWrapper<T> > {
typedef T* Type; typedef T* Type;
static Type copy(const AllowCrossThreadAccessWrapper<T>& wrapper) { return wrapper.value(); } static Type copy(const AllowCrossThreadAccessWrapper<T>& wrapper) { return wrapper.value(); }
}; };
...@@ -175,7 +164,7 @@ namespace WebCore { ...@@ -175,7 +164,7 @@ namespace WebCore {
T* m_value; T* m_value;
}; };
template<typename T> struct CrossThreadCopierBase<false, false, false, AllowAccessLaterWrapper<T> > { template<typename T> struct CrossThreadCopierBase<false, false, AllowAccessLaterWrapper<T> > {
typedef T* Type; typedef T* Type;
static Type copy(const AllowAccessLaterWrapper<T>& wrapper) { return wrapper.value(); } static Type copy(const AllowAccessLaterWrapper<T>& wrapper) { return wrapper.value(); }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment