Skip to content

Commit

Permalink
Merge r182378 - UserScript, UserStyleSheet constructors should take i…
Browse files Browse the repository at this point in the history
…n Vector<String> rvalue references

https://bugs.webkit.org/show_bug.cgi?id=143411

Reviewed by Darin Adler.

Have the UserScript and UserStyleSheet constructors take in Vector<String>
rvalue references for the whitelist and blacklist parameters. Both classes
store these Vector<String> objects, so the referenced objects can simply be
moved into the member variable.

Because the constructor is now demanding an rvalue, it's up to the caller
to move in the desired object if possible, or create an explicit copy
otherwise.

* page/UserScript.h:
(WebCore::UserScript::UserScript):
* page/UserStyleSheet.h:
(WebCore::UserStyleSheet::UserStyleSheet):

Source/WebKit2:
UserScript, UserStyleSheet constructors should take in Vector<String> rvalues
https://bugs.webkit.org/show_bug.cgi?id=143411

Reviewed by Darin Adler.

Move the whitelist and blacklist Vector<String> objects into the
UserScript and UserStyleSheet constructors in ArgumentCoder<T>::decode
functions.

* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<UserStyleSheet>::decode):
(IPC::ArgumentCoder<UserScript>::decode):
  • Loading branch information
zdobersek authored and carlosgcampos committed Apr 13, 2015
1 parent 19325f7 commit df12bd4
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 8 deletions.
21 changes: 21 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,24 @@
2015-04-06 Žan Doberšek <zdobersek@igalia.com>

UserScript, UserStyleSheet constructors should take in Vector<String> rvalue references
https://bugs.webkit.org/show_bug.cgi?id=143411

Reviewed by Darin Adler.

Have the UserScript and UserStyleSheet constructors take in Vector<String>
rvalue references for the whitelist and blacklist parameters. Both classes
store these Vector<String> objects, so the referenced objects can simply be
moved into the member variable.

Because the constructor is now demanding an rvalue, it's up to the caller
to move in the desired object if possible, or create an explicit copy
otherwise.

* page/UserScript.h:
(WebCore::UserScript::UserScript):
* page/UserStyleSheet.h:
(WebCore::UserStyleSheet::UserStyleSheet):

2015-04-05 Darin Adler <darin@apple.com>

FrameView code uses page() without null checking
Expand Down
6 changes: 3 additions & 3 deletions Source/WebCore/page/UserScript.h
Expand Up @@ -42,11 +42,11 @@ class UserScript {
{
}

UserScript(const String& source, const URL& url, const Vector<String>& whitelist, const Vector<String>& blacklist, UserScriptInjectionTime injectionTime, UserContentInjectedFrames injectedFrames)
UserScript(const String& source, const URL& url, Vector<String>&& whitelist, Vector<String>&& blacklist, UserScriptInjectionTime injectionTime, UserContentInjectedFrames injectedFrames)
: m_source(source)
, m_url(url)
, m_whitelist(whitelist)
, m_blacklist(blacklist)
, m_whitelist(WTF::move(whitelist))
, m_blacklist(WTF::move(blacklist))
, m_injectionTime(injectionTime)
, m_injectedFrames(injectedFrames)
{
Expand Down
6 changes: 3 additions & 3 deletions Source/WebCore/page/UserStyleSheet.h
Expand Up @@ -42,11 +42,11 @@ class UserStyleSheet {
{
}

UserStyleSheet(const String& source, const URL& url, const Vector<String>& whitelist, const Vector<String>& blacklist, UserContentInjectedFrames injectedFrames, UserStyleLevel level)
UserStyleSheet(const String& source, const URL& url, Vector<String>&& whitelist, Vector<String>&& blacklist, UserContentInjectedFrames injectedFrames, UserStyleLevel level)
: m_source(source)
, m_url(url)
, m_whitelist(whitelist)
, m_blacklist(blacklist)
, m_whitelist(WTF::move(whitelist))
, m_blacklist(WTF::move(blacklist))
, m_injectedFrames(injectedFrames)
, m_level(level)
{
Expand Down
15 changes: 15 additions & 0 deletions Source/WebKit2/ChangeLog
@@ -1,3 +1,18 @@
2015-04-06 Žan Doberšek <zdobersek@igalia.com>

UserScript, UserStyleSheet constructors should take in Vector<String> rvalues
https://bugs.webkit.org/show_bug.cgi?id=143411

Reviewed by Darin Adler.

Move the whitelist and blacklist Vector<String> objects into the
UserScript and UserStyleSheet constructors in ArgumentCoder<T>::decode
functions.

* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<UserStyleSheet>::decode):
(IPC::ArgumentCoder<UserScript>::decode):

2015-04-02 Alexey Proskuryakov <ap@apple.com>

Make checkURLReceivedFromWebProcess not rely on details of platform URL implementation.
Expand Down
4 changes: 2 additions & 2 deletions Source/WebKit2/Shared/WebCoreArgumentCoders.cpp
Expand Up @@ -1299,7 +1299,7 @@ bool ArgumentCoder<UserStyleSheet>::decode(ArgumentDecoder& decoder, UserStyleSh
if (!decoder.decodeEnum(level))
return false;

userStyleSheet = UserStyleSheet(source, url, whitelist, blacklist, injectedFrames, level);
userStyleSheet = UserStyleSheet(source, url, WTF::move(whitelist), WTF::move(blacklist), injectedFrames, level);
return true;
}

Expand Down Expand Up @@ -1339,7 +1339,7 @@ bool ArgumentCoder<UserScript>::decode(ArgumentDecoder& decoder, UserScript& use
if (!decoder.decodeEnum(injectedFrames))
return false;

userScript = UserScript(source, url, whitelist, blacklist, injectionTime, injectedFrames);
userScript = UserScript(source, url, WTF::move(whitelist), WTF::move(blacklist), injectionTime, injectedFrames);
return true;
}

Expand Down

0 comments on commit df12bd4

Please sign in to comment.