Summary: | Remove memcpy from ScriptSourceCode::source() | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Adam Barth <abarth> | ||||||
Component: | WebCore JavaScript | Assignee: | Adam Barth <abarth> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | abarth, darin, dglazkov, levin | ||||||
Priority: | P2 | ||||||||
Version: | 528+ (Nightly build) | ||||||||
Hardware: | All | ||||||||
OS: | All | ||||||||
Attachments: |
|
Description
Adam Barth
2009-06-19 16:40:01 PDT
Created attachment 31574 [details]
patch
Notice that the string is kept alive anyway because the
ScriptSourceCode holds a JSC::SourceCode which holds a RefPtr<SourceProvider>
which holds String m_source (via StringSourceProvider : public
JSC::SourceProvider).
Created attachment 31576 [details]
patch
Oops. Forgot the const.
Comment on attachment 31574 [details] patch > + // This same string is actually buried in m_code, but there isn't a clean > + // want to write an accessor for it, so we cache a refernce to it. > + String m_source; "clean want"? How about "clean way"? But I do think there is a clean way to get at it. Just add a source() member to StringSourceProvider, then call static_cast<StringSourceProvider*>(m_code->provider())->source(). Comment on attachment 31576 [details]
patch
It's not really buried all that deeply. I seriously think you could just do static_cast<StringSourceProvider*>(m_code->provider())->source(). r=me
> It's not really buried all that deeply. I seriously think you could just do
> static_cast<StringSourceProvider*>(m_code->provider())->source(). r=me
Ah. I hadn't considered using a static_cast. That should work.
Sending WebCore/ChangeLog Sending WebCore/bindings/js/ScriptSourceCode.h Sending WebCore/bindings/js/StringSourceProvider.h Transmitting file data ... Committed revision 44894. |