Loading a worker script should not be O(n^2)
authorabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 31 Aug 2012 04:00:54 +0000 (04:00 +0000)
committerabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 31 Aug 2012 04:00:54 +0000 (04:00 +0000)
commit0c74dfca993bf4e37ac9a8a26a5bcadf17a661a3
tree4ee8fe0fb9eff3bbffcd82c2b2cab4e42a7ef674
parentd93dbf7a5c0287044e2162c75f8d76bfddb64cb7
Loading a worker script should not be O(n^2)
https://bugs.webkit.org/show_bug.cgi?id=95518

Reviewed by Benjamin Poulain.

Previously, we would malloc a new buffer and memcpy the entire worker
script every time we got another packet of data from the network. This
patch uses StringBuilder to accumulate the buffer more efficiently.

* workers/WorkerScriptLoader.cpp:
(WebCore::WorkerScriptLoader::WorkerScriptLoader):
(WebCore::WorkerScriptLoader::didReceiveData):
(WebCore::WorkerScriptLoader::didFinishLoading):
(WebCore):
(WebCore::WorkerScriptLoader::script):
* workers/WorkerScriptLoader.h:
(WorkerScriptLoader):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@127227 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/workers/WorkerScriptLoader.cpp
Source/WebCore/workers/WorkerScriptLoader.h