From: Steve Block Date: Fri, 9 Oct 2009 16:07:41 +0000 (+0100) Subject: Merge webkit.org at R49305 : Update String::copy call sites to use new copy method. X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=8e1c14d2;p=android-x86%2Fexternal-webkit.git Merge webkit.org at R49305 : Update String::copy call sites to use new copy method. See http://trac.webkit.org/changeset/49160 Change-Id: I75e1d6701f4d16fab7513f5924abf00e958e865c --- diff --git a/WebCore/platform/android/FileChooserAndroid.cpp b/WebCore/platform/android/FileChooserAndroid.cpp index d54c80974..c293e66a3 100644 --- a/WebCore/platform/android/FileChooserAndroid.cpp +++ b/WebCore/platform/android/FileChooserAndroid.cpp @@ -36,7 +36,9 @@ String FileChooser::basenameForWidth(const Font& font, int width) const return String(); // FIXME: This could be a lot faster, but assuming the data will not // often be much longer than the provided width, this may be fast enough. - String output = m_filenames[0].copy(); + // If this does not need to be threadsafe, we can use crossThreadString(). + // See http://trac.webkit.org/changeset/49160. + String output = m_filenames[0].threadsafeCopy(); while (font.width(TextRun(output.impl())) > width && output.length() > 4) { output = output.replace(0, 4, String("...")); } @@ -58,4 +60,3 @@ String fileButtonNoFileSelectedLabel() } } // namesapce WebCore - diff --git a/WebKit/android/nav/CacheBuilder.cpp b/WebKit/android/nav/CacheBuilder.cpp index 80965d2c5..72dad0719 100644 --- a/WebKit/android/nav/CacheBuilder.cpp +++ b/WebKit/android/nav/CacheBuilder.cpp @@ -1106,7 +1106,9 @@ void CacheBuilder::BuildFrame(Frame* root, Frame* frame, } isPassword = input->inputType() == HTMLInputElement::PASSWORD; maxLength = input->maxLength(); - name = input->name().string().copy(); + // If this does not need to be threadsafe, we can use crossThreadString(). + // See http://trac.webkit.org/changeset/49160. + name = input->name().string().threadsafeCopy(); isUnclipped = isTransparent; // can't detect if this is drawn on top (example: deviant.com login parts) } else if (node->hasTagName(HTMLNames::textareaTag)) { isTextArea = wantsKeyEvents = true; @@ -1123,14 +1125,14 @@ void CacheBuilder::BuildFrame(Frame* root, Frame* frame, KURL href = anchorNode->href(); if (!href.isEmpty() && !WebCore::protocolIsJavaScript(href.string())) // Set the exported string for all non-javascript anchors. - exported = href.string().copy(); + exported = href.string().threadsafeCopy(); } if (isTextField || isTextArea) { RenderTextControl* renderText = static_cast(nodeRenderer); if (isFocus) cachedRoot->setSelection(renderText->selectionStart(), renderText->selectionEnd()); - exported = renderText->text().copy(); + exported = renderText->text().threadsafeCopy(); // FIXME: Would it be better to use (float) size()? // FIXME: Are we sure there will always be a style and font, and it's correct? RenderStyle* style = nodeRenderer->style();