Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: webkit/api/src/WebSharedWorkerImpl.cpp

Issue 372047: Fixed worker startup issue (Closed)
Patch Set: Removed tests to a separate patch. Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 { 59 {
60 } 60 }
61 61
62 bool WebSharedWorkerImpl::isStarted() 62 bool WebSharedWorkerImpl::isStarted()
63 { 63 {
64 // Should not ever be called from the worker thread (this API is only called on WebSharedWorkerProxy on the renderer thread). 64 // Should not ever be called from the worker thread (this API is only called on WebSharedWorkerProxy on the renderer thread).
65 ASSERT_NOT_REACHED(); 65 ASSERT_NOT_REACHED();
66 return workerThread(); 66 return workerThread();
67 } 67 }
68 68
69 void WebSharedWorkerImpl::connect(WebMessagePortChannel* webChannel) 69 void WebSharedWorkerImpl::connect(WebMessagePortChannel* webChannel, ConnectListener* listener)
70 { 70 {
71 // Convert the WebMessagePortChanel to a WebCore::MessagePortChannel. 71 // Convert the WebMessagePortChanel to a WebCore::MessagePortChannel.
72 RefPtr<PlatformMessagePortChannel> platform_channel = 72 RefPtr<PlatformMessagePortChannel> platform_channel =
73 PlatformMessagePortChannel::create(webChannel); 73 PlatformMessagePortChannel::create(webChannel);
74 webChannel->setClient(platform_channel.get()); 74 webChannel->setClient(platform_channel.get());
75 OwnPtr<MessagePortChannel> channel = 75 OwnPtr<MessagePortChannel> channel =
76 MessagePortChannel::create(platform_channel); 76 MessagePortChannel::create(platform_channel);
77 77
78 workerThread()->runLoop().postTask( 78 workerThread()->runLoop().postTask(
79 createCallbackTask(&connectTask, this, channel.release())); 79 createCallbackTask(&connectTask, this, channel.release()));
80 if (listener)
81 listener->connected();
80 } 82 }
81 83
82 void WebSharedWorkerImpl::connectTask(ScriptExecutionContext* context, WebSharedWorkerImpl* worker, PassOwnPtr<MessagePortChannel> channel) 84 void WebSharedWorkerImpl::connectTask(ScriptExecutionContext* context, WebSharedWorkerImpl* worker, PassOwnPtr<MessagePortChannel> channel)
83 { 85 {
84 // Wrap the passed-in channel in a MessagePort, and send it off via a connect event. 86 // Wrap the passed-in channel in a MessagePort, and send it off via a connect event.
85 RefPtr<MessagePort> port = MessagePort::create(*context); 87 RefPtr<MessagePort> port = MessagePort::create(*context);
86 port->entangle(channel.release()); 88 port->entangle(channel.release());
87 ASSERT(context->isWorkerContext()); 89 ASSERT(context->isWorkerContext());
88 WorkerContext* workerContext = static_cast<WorkerContext*>(context); 90 WorkerContext* workerContext = static_cast<WorkerContext*>(context);
89 ASSERT(workerContext->isSharedWorkerContext()); 91 ASSERT(workerContext->isSharedWorkerContext());
(...skipping 26 matching lines...) Expand all
116 } 118 }
117 119
118 WebSharedWorker* WebSharedWorker::create(WebCommonWorkerClient* client) 120 WebSharedWorker* WebSharedWorker::create(WebCommonWorkerClient* client)
119 { 121 {
120 return new WebSharedWorkerImpl(client); 122 return new WebSharedWorkerImpl(client);
121 } 123 }
122 124
123 #endif // ENABLE(SHARED_WORKERS) 125 #endif // ENABLE(SHARED_WORKERS)
124 126
125 } // namespace WebKit 127 } // namespace WebKit
OLDNEW
« webkit/api/public/WebSharedWorker.h ('K') | « webkit/api/src/WebSharedWorkerImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698