Bug 30095 - StringImpl needs a method to get an instance for another thread which doesn't copy the underlying buffer.
Summary: StringImpl needs a method to get an instance for another thread which doesn't...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: David Levin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-05 14:51 PDT by David Levin
Modified: 2009-10-06 00:46 PDT (History)
1 user (show)

See Also:


Attachments
Proposed fix. (42.66 KB, patch)
2009-10-05 15:26 PDT, David Levin
oliver: review+
levin: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Levin 2009-10-05 14:51:07 PDT
The primary motivation has been long strings that can be formed in workers which need to be passed to the main thread, but this should benefit other places as well.
Comment 1 David Levin 2009-10-05 15:26:37 PDT
Created attachment 40667 [details]
Proposed fix.
Comment 2 David Levin 2009-10-05 15:40:15 PDT
This is in support of finally implementing WorkerContext::resourceRetrievedByXMLHttpRequest and WorkerContext::scriptImported.
Comment 3 Jeremy Orlow 2009-10-05 15:43:03 PDT
One nit:

> diff --git a/WebCore/storage/StorageNamespaceImpl.cpp b/WebCore/storage/StorageNamespaceImpl.cpp
> index bc9d90c..ab540f1 100644
> --- a/WebCore/storage/StorageNamespaceImpl.cpp
> +++ b/WebCore/storage/StorageNamespaceImpl.cpp
> @@ -65,7 +65,7 @@ PassRefPtr<StorageNamespace> StorageNamespaceImpl::sessionStorageNamespace()
>  
>  StorageNamespaceImpl::StorageNamespaceImpl(StorageType storageType, const String& path, unsigned quota)
>      : m_storageType(storageType)
> -    , m_path(path.copy())  // Copy makes it safe for our other thread to access the path.
> +    , m_path(path.crossThreadString()) // Make it safe for our other thread to access the path.

This comment seems redundant now.
Comment 4 David Levin 2009-10-05 17:47:47 PDT
Comment on attachment 40667 [details]
Proposed fix.

Just marking as cq- because I want to land this myself.
Comment 5 Mark Rowe (bdash) 2009-10-05 19:12:39 PDT
"call was made threadsafeCopy unless I could show that *threadsafey* wasn't needed."
Comment 6 David Levin 2009-10-06 00:46:26 PDT
Committed as http://trac.webkit.org/changeset/49160.