Title: [137342] trunk/Source/WebKit2
Revision
137342
Author
[email protected]
Date
2012-12-11 12:49:58 -0800 (Tue, 11 Dec 2012)

Log Message

Initialize new web processes with list of auto-start origins for plug-ins
https://bugs.webkit.org/show_bug.cgi?id=103219
<rdar://problem/12747219>

Reviewed by Anders Carlsson.

Serialize the set of hashes into a vector as a parameter in web process creation.

* Shared/WebProcessCreationParameters.h: Add a parameter for the origin hashes.

* Shared/WebProcessCreationParameters.cpp: Encode/decode that parameter.
(WebKit::WebProcessCreationParameters::encode):
(WebKit::WebProcessCreationParameters::decode):

* UIProcess/Plugins/PlugInAutoStartProvider.cpp:
(WebKit::PlugInAutoStartProvider::autoStartOriginsCopy): Return a vector copy with contents from the
hash set.
* UIProcess/Plugins/PlugInAutoStartProvider.h:
(PlugInAutoStartProvider):

* UIProcess/WebContext.cpp:
(WebKit::WebContext::createNewWebProcess): Populate the parameter with the contents of the set.
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess): Add the items in the vector to the web process' copy of the set.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (137341 => 137342)


--- trunk/Source/WebKit2/ChangeLog	2012-12-11 20:46:56 UTC (rev 137341)
+++ trunk/Source/WebKit2/ChangeLog	2012-12-11 20:49:58 UTC (rev 137342)
@@ -1,3 +1,30 @@
+2012-12-11  Jon Lee  <[email protected]>
+
+        Initialize new web processes with list of auto-start origins for plug-ins
+        https://bugs.webkit.org/show_bug.cgi?id=103219
+        <rdar://problem/12747219>
+
+        Reviewed by Anders Carlsson.
+
+        Serialize the set of hashes into a vector as a parameter in web process creation.
+
+        * Shared/WebProcessCreationParameters.h: Add a parameter for the origin hashes.
+
+        * Shared/WebProcessCreationParameters.cpp: Encode/decode that parameter.
+        (WebKit::WebProcessCreationParameters::encode):
+        (WebKit::WebProcessCreationParameters::decode):
+
+        * UIProcess/Plugins/PlugInAutoStartProvider.cpp:
+        (WebKit::PlugInAutoStartProvider::autoStartOriginsCopy): Return a vector copy with contents from the
+        hash set.
+        * UIProcess/Plugins/PlugInAutoStartProvider.h:
+        (PlugInAutoStartProvider):
+
+        * UIProcess/WebContext.cpp:
+        (WebKit::WebContext::createNewWebProcess): Populate the parameter with the contents of the set.
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::initializeWebProcess): Add the items in the vector to the web process' copy of the set.
+
 2012-12-11  Andreas Kling  <[email protected]>
 
         CoreIPC: ArgumentEncoder should have an inline buffer.

Modified: trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp (137341 => 137342)


--- trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp	2012-12-11 20:46:56 UTC (rev 137341)
+++ trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp	2012-12-11 20:49:58 UTC (rev 137342)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -121,6 +121,8 @@
 #if ENABLE(NETWORK_PROCESS)
     encoder << usesNetworkProcess;
 #endif
+
+    encoder << plugInAutoStartOrigins;
 }
 
 bool WebProcessCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, WebProcessCreationParameters& parameters)
@@ -241,6 +243,9 @@
         return false;
 #endif
 
+    if (!decoder->decode(parameters.plugInAutoStartOrigins))
+        return false;
+
     return true;
 }
 

Modified: trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h (137341 => 137342)


--- trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h	2012-12-11 20:46:56 UTC (rev 137341)
+++ trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h	2012-12-11 20:49:58 UTC (rev 137342)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -135,6 +135,8 @@
 #if ENABLE(NETWORK_PROCESS)
     bool usesNetworkProcess;
 #endif
+
+    Vector<unsigned> plugInAutoStartOrigins;
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/Plugins/PlugInAutoStartProvider.cpp (137341 => 137342)


--- trunk/Source/WebKit2/UIProcess/Plugins/PlugInAutoStartProvider.cpp	2012-12-11 20:46:56 UTC (rev 137341)
+++ trunk/Source/WebKit2/UIProcess/Plugins/PlugInAutoStartProvider.cpp	2012-12-11 20:49:58 UTC (rev 137342)
@@ -52,4 +52,11 @@
     m_context->sendToAllProcesses(Messages::WebProcess::DidAddPlugInAutoStartOrigin(plugInOriginHash));
 }
 
+Vector<unsigned> PlugInAutoStartProvider::autoStartOriginsCopy() const
+{
+    Vector<unsigned> copyVector;
+    copyToVector(m_autoStartHashes, copyVector);
+    return copyVector;
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/Plugins/PlugInAutoStartProvider.h (137341 => 137342)


--- trunk/Source/WebKit2/UIProcess/Plugins/PlugInAutoStartProvider.h	2012-12-11 20:46:56 UTC (rev 137341)
+++ trunk/Source/WebKit2/UIProcess/Plugins/PlugInAutoStartProvider.h	2012-12-11 20:49:58 UTC (rev 137342)
@@ -41,6 +41,7 @@
     explicit PlugInAutoStartProvider(WebContext*);
 
     void addAutoStartOrigin(const String& pageOrigin, unsigned plugInOriginHash);
+    Vector<unsigned> autoStartOriginsCopy() const;
 
 private:
     WebContext* m_context;

Modified: trunk/Source/WebKit2/UIProcess/WebContext.cpp (137341 => 137342)


--- trunk/Source/WebKit2/UIProcess/WebContext.cpp	2012-12-11 20:46:56 UTC (rev 137341)
+++ trunk/Source/WebKit2/UIProcess/WebContext.cpp	2012-12-11 20:49:58 UTC (rev 137342)
@@ -465,6 +465,8 @@
     parameters.usesNetworkProcess = m_usesNetworkProcess;
 #endif
 
+    parameters.plugInAutoStartOrigins = m_plugInAutoStartProvider.autoStartOriginsCopy();
+
     // Add any platform specific parameters
     platformInitializeWebProcess(parameters);
 

Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (137341 => 137342)


--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp	2012-12-11 20:46:56 UTC (rev 137341)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp	2012-12-11 20:49:58 UTC (rev 137342)
@@ -304,6 +304,9 @@
     ensureNetworkProcessConnection();
 #endif
     setTerminationTimeout(parameters.terminationTimeout);
+
+    for (size_t i = 0; i < parameters.plugInAutoStartOrigins.size(); ++i)
+        didAddPlugInAutoStartOrigin(parameters.plugInAutoStartOrigins[i]);
 }
 
 #if ENABLE(NETWORK_PROCESS)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to