<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[206051] branches/safari-602-branch/Source/WebKit2</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/206051">206051</a></dd>
<dt>Author</dt> <dd>bshafiei@apple.com</dd>
<dt>Date</dt> <dd>2016-09-16 14:43:02 -0700 (Fri, 16 Sep 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/206000">r206000</a>. rdar://problem/27991573</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari602branchSourceWebKit2ChangeLog">branches/safari-602-branch/Source/WebKit2/ChangeLog</a></li>
<li><a href="#branchessafari602branchSourceWebKit2Scriptswebkitmessagespy">branches/safari-602-branch/Source/WebKit2/Scripts/webkit/messages.py</a></li>
<li><a href="#branchessafari602branchSourceWebKit2Scriptswebkitparserpy">branches/safari-602-branch/Source/WebKit2/Scripts/webkit/parser.py</a></li>
<li><a href="#branchessafari602branchSourceWebKit2SharedLayerTreeContexth">branches/safari-602-branch/Source/WebKit2/Shared/LayerTreeContext.h</a></li>
<li><a href="#branchessafari602branchSourceWebKit2UIProcessWebPageProxycpp">branches/safari-602-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#branchessafari602branchSourceWebKit2WebProcessWebPageWebPagecpp">branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#branchessafari602branchSourceWebKit2WebProcessWebPageWebPageh">branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h</a></li>
<li><a href="#branchessafari602branchSourceWebKit2WebProcessWebPageWebPagemessagesin">branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari602branchSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebKit2/ChangeLog (206050 => 206051)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebKit2/ChangeLog        2016-09-16 21:42:58 UTC (rev 206050)
+++ branches/safari-602-branch/Source/WebKit2/ChangeLog        2016-09-16 21:43:02 UTC (rev 206051)
</span><span class="lines">@@ -1,5 +1,55 @@
</span><span class="cx"> 2016-09-16 Babak Shafiei <bshafiei@apple.com>
</span><span class="cx">
</span><ins>+ Merge r206000. rdar://problem/27991573
+
+ 2016-09-15 Anders Carlsson <andersca@apple.com>
+
+ Add support for enum class parameters in the message generator
+ https://bugs.webkit.org/show_bug.cgi?id=162036
+
+ Reviewed by Brady Eidson.
+
+ Also, convert the WebPage::SetLayerHostingMode to take an actual enum class.
+
+ * Scripts/webkit/messages.py:
+ (function_parameter_type):
+ Change this to take the parameter kind as well, and use the raw type for enums.
+
+ (arguments_type):
+ (message_to_struct_declaration):
+ Pass the kind to function_parameter_type.
+
+ (forward_declaration):
+ (forward_declarations_for_namespace):
+ Forward declare enums with "enum class".
+
+ (headers_for_type):
+ Add WebKit::LayerHostingMode as a special case.
+
+ (generate_message_handler):
+ Pass the kind to function_parameter_type.
+
+ * Scripts/webkit/parser.py:
+ (parse_parameters_string):
+ Parse 'enum' as well.
+
+ * Shared/LayerTreeContext.h:
+ Add enum traits.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::viewDidEnterWindow):
+ (WebKit::WebPageProxy::layerHostingModeDidChange):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::reinitializeWebPage):
+ (WebKit::WebPage::setLayerHostingMode):
+ * WebProcess/WebPage/WebPage.h:
+ Change unsigned to LayerHostingMode.
+
+ * WebProcess/WebPage/WebPage.messages.in:
+ Change unsigned to LayerHostingMode.
+
+2016-09-16 Babak Shafiei <bshafiei@apple.com>
+
</ins><span class="cx"> Merge r204916. rdar://problem/27991573
</span><span class="cx">
</span><span class="cx"> 2016-08-23 Anders Carlsson <andersca@apple.com>
</span></span></pre></div>
<a id="branchessafari602branchSourceWebKit2Scriptswebkitmessagespy"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebKit2/Scripts/webkit/messages.py (206050 => 206051)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebKit2/Scripts/webkit/messages.py        2016-09-16 21:42:58 UTC (rev 206050)
+++ branches/safari-602-branch/Source/WebKit2/Scripts/webkit/messages.py        2016-09-16 21:43:02 UTC (rev 206051)
</span><span class="lines">@@ -66,7 +66,7 @@
</span><span class="cx"> return '#if %s\n%s#endif\n' % (condition, string)
</span><span class="cx">
</span><span class="cx">
</span><del>-def function_parameter_type(type):
</del><ins>+def function_parameter_type(type, kind):
</ins><span class="cx"> # Don't use references for built-in types.
</span><span class="cx"> builtin_types = frozenset([
</span><span class="cx"> 'bool',
</span><span class="lines">@@ -85,6 +85,9 @@
</span><span class="cx"> if type in builtin_types:
</span><span class="cx"> return type
</span><span class="cx">
</span><ins>+ if kind == 'enum':
+ return type
+
</ins><span class="cx"> return 'const %s&' % type
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -93,7 +96,7 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> def arguments_type(message):
</span><del>- return 'std::tuple<%s>' % ', '.join(function_parameter_type(parameter.type) for parameter in message.parameters)
</del><ins>+ return 'std::tuple<%s>' % ', '.join(function_parameter_type(parameter.type, parameter.kind) for parameter in message.parameters)
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> def reply_type(message):
</span><span class="lines">@@ -106,7 +109,7 @@
</span><span class="cx">
</span><span class="cx"> def message_to_struct_declaration(message):
</span><span class="cx"> result = []
</span><del>- function_parameters = [(function_parameter_type(x.type), x.name) for x in message.parameters]
</del><ins>+ function_parameters = [(function_parameter_type(x.type, x.kind), x.name) for x in message.parameters]
</ins><span class="cx"> result.append('class %s {\n' % message.name)
</span><span class="cx"> result.append('public:\n')
</span><span class="cx"> result.append(' typedef %s DecodeType;\n' % decode_type(message))
</span><span class="lines">@@ -117,7 +120,7 @@
</span><span class="cx"> result.append('\n')
</span><span class="cx"> if message.reply_parameters != None:
</span><span class="cx"> if message.has_attribute(DELAYED_ATTRIBUTE):
</span><del>- send_parameters = [(function_parameter_type(x.type), x.name) for x in message.reply_parameters]
</del><ins>+ send_parameters = [(function_parameter_type(x.type, x.kind), x.name) for x in message.reply_parameters]
</ins><span class="cx"> result.append(' struct DelayedReply : public ThreadSafeRefCounted<DelayedReply> {\n')
</span><span class="cx"> result.append(' DelayedReply(PassRefPtr<IPC::Connection>, std::unique_ptr<IPC::MessageEncoder>);\n')
</span><span class="cx"> result.append(' ~DelayedReply();\n')
</span><span class="lines">@@ -147,20 +150,21 @@
</span><span class="cx"> return surround_in_condition(''.join(result), message.condition)
</span><span class="cx">
</span><span class="cx">
</span><del>-def struct_or_class(namespace, kind_and_type):
</del><ins>+def forward_declaration(namespace, kind_and_type):
</ins><span class="cx"> kind, type = kind_and_type
</span><span class="cx">
</span><span class="cx"> qualified_name = '%s::%s' % (namespace, type)
</span><span class="cx"> if kind == 'struct':
</span><span class="cx"> return 'struct %s' % type
</span><ins>+ elif kind == 'enum':
+ return 'enum class %s' % type
</ins><span class="cx"> else:
</span><span class="cx"> return 'class %s' % type
</span><span class="cx">
</span><del>-
</del><span class="cx"> def forward_declarations_for_namespace(namespace, kind_and_types):
</span><span class="cx"> result = []
</span><span class="cx"> result.append('namespace %s {\n' % namespace)
</span><del>- result += [' %s;\n' % struct_or_class(namespace, x) for x in kind_and_types]
</del><ins>+ result += [' %s;\n' % forward_declaration(namespace, x) for x in kind_and_types]
</ins><span class="cx"> result.append('}\n')
</span><span class="cx"> return ''.join(result)
</span><span class="cx">
</span><span class="lines">@@ -381,6 +385,7 @@
</span><span class="cx"> 'struct WebKit::WebUserStyleSheetData': ['"WebUserContentControllerDataTypes.h"'],
</span><span class="cx"> 'struct WebKit::WebScriptMessageHandlerData': ['"WebUserContentControllerDataTypes.h"'],
</span><span class="cx"> 'std::chrono::system_clock::time_point': ['<chrono>'],
</span><ins>+ 'WebKit::LayerHostingMode': ['"LayerTreeContext.h"'],
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> headers = []
</span><span class="lines">@@ -484,7 +489,7 @@
</span><span class="cx"> result.append('namespace Messages {\n\nnamespace %s {\n\n' % receiver.name)
</span><span class="cx">
</span><span class="cx"> for message in sync_delayed_messages:
</span><del>- send_parameters = [(function_parameter_type(x.type), x.name) for x in message.reply_parameters]
</del><ins>+ send_parameters = [(function_parameter_type(x.type, x.kind), x.name) for x in message.reply_parameters]
</ins><span class="cx">
</span><span class="cx"> if message.condition:
</span><span class="cx"> result.append('#if %s\n\n' % message.condition)
</span></span></pre></div>
<a id="branchessafari602branchSourceWebKit2Scriptswebkitparserpy"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebKit2/Scripts/webkit/parser.py (206050 => 206051)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebKit2/Scripts/webkit/parser.py        2016-09-16 21:42:58 UTC (rev 206050)
+++ branches/safari-602-branch/Source/WebKit2/Scripts/webkit/parser.py        2016-09-16 21:43:02 UTC (rev 206051)
</span><span class="lines">@@ -133,6 +133,9 @@
</span><span class="cx"> if split[0].startswith('struct '):
</span><span class="cx"> parameter_kind = 'struct'
</span><span class="cx"> split[0] = split[0][7:]
</span><ins>+ elif split[0].startswith('enum '):
+ parameter_kind = 'enum'
+ split[0] = split[0][5:]
</ins><span class="cx">
</span><span class="cx"> parameter_type = split[0]
</span><span class="cx"> parameter_name = split[1]
</span></span></pre></div>
<a id="branchessafari602branchSourceWebKit2SharedLayerTreeContexth"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebKit2/Shared/LayerTreeContext.h (206050 => 206051)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebKit2/Shared/LayerTreeContext.h        2016-09-16 21:42:58 UTC (rev 206050)
+++ branches/safari-602-branch/Source/WebKit2/Shared/LayerTreeContext.h        2016-09-16 21:43:02 UTC (rev 206051)
</span><span class="lines">@@ -23,10 +23,10 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#ifndef LayerTreeContext_h
-#define LayerTreeContext_h
</del><ins>+#pragma once
</ins><span class="cx">
</span><span class="cx"> #include <stdint.h>
</span><ins>+#include <wtf/EnumTraits.h>
</ins><span class="cx">
</span><span class="cx"> namespace IPC {
</span><span class="cx"> class ArgumentDecoder;
</span><span class="lines">@@ -62,6 +62,16 @@
</span><span class="cx"> return !(a == b);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+}
+
+namespace WTF {
+template<> struct EnumTraits<WebKit::LayerHostingMode> {
+ using values = EnumValues<
+ WebKit::LayerHostingMode,
+#if HAVE(OUT_OF_PROCESS_LAYER_HOSTING)
+ WebKit::LayerHostingMode::OutOfProcess,
+#endif
+ WebKit::LayerHostingMode::InProcess
+ >;
</ins><span class="cx"> };
</span><del>-
-#endif // LayerTreeContext_h
</del><ins>+}
</ins></span></pre></div>
<a id="branchessafari602branchSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp (206050 => 206051)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp        2016-09-16 21:42:58 UTC (rev 206050)
+++ branches/safari-602-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp        2016-09-16 21:43:02 UTC (rev 206051)
</span><span class="lines">@@ -1499,7 +1499,7 @@
</span><span class="cx"> LayerHostingMode layerHostingMode = m_pageClient.viewLayerHostingMode();
</span><span class="cx"> if (m_layerHostingMode != layerHostingMode) {
</span><span class="cx"> m_layerHostingMode = layerHostingMode;
</span><del>- m_process->send(Messages::WebPage::SetLayerHostingMode(static_cast<unsigned>(layerHostingMode)), m_pageID);
</del><ins>+ m_process->send(Messages::WebPage::SetLayerHostingMode(layerHostingMode), m_pageID);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1616,7 +1616,7 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> m_layerHostingMode = layerHostingMode;
</span><del>- m_process->send(Messages::WebPage::SetLayerHostingMode(static_cast<unsigned>(layerHostingMode)), m_pageID);
</del><ins>+ m_process->send(Messages::WebPage::SetLayerHostingMode(layerHostingMode), m_pageID);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebPageProxy::waitForDidUpdateViewState()
</span></span></pre></div>
<a id="branchessafari602branchSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (206050 => 206051)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2016-09-16 21:42:58 UTC (rev 206050)
+++ branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2016-09-16 21:43:02 UTC (rev 206051)
</span><span class="lines">@@ -571,7 +571,7 @@
</span><span class="cx"> if (m_viewState != parameters.viewState)
</span><span class="cx"> setViewState(parameters.viewState, false, Vector<uint64_t>());
</span><span class="cx"> if (m_layerHostingMode != parameters.layerHostingMode)
</span><del>- setLayerHostingMode(static_cast<unsigned>(parameters.layerHostingMode));
</del><ins>+ setLayerHostingMode(parameters.layerHostingMode);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebPage::setPageActivityState(PageActivityState::Flags activityState)
</span><span class="lines">@@ -2593,9 +2593,9 @@
</span><span class="cx"> updateIsInWindow();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebPage::setLayerHostingMode(unsigned layerHostingMode)
</del><ins>+void WebPage::setLayerHostingMode(LayerHostingMode layerHostingMode)
</ins><span class="cx"> {
</span><del>- m_layerHostingMode = static_cast<LayerHostingMode>(layerHostingMode);
</del><ins>+ m_layerHostingMode = layerHostingMode;
</ins><span class="cx">
</span><span class="cx"> m_drawingArea->setLayerHostingMode(m_layerHostingMode);
</span><span class="cx">
</span></span></pre></div>
<a id="branchessafari602branchSourceWebKit2WebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h (206050 => 206051)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h        2016-09-16 21:42:58 UTC (rev 206050)
+++ branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h        2016-09-16 21:43:02 UTC (rev 206051)
</span><span class="lines">@@ -436,7 +436,7 @@
</span><span class="cx"> bool isVisibleOrOccluded() const { return m_viewState & WebCore::ViewState::IsVisibleOrOccluded; }
</span><span class="cx">
</span><span class="cx"> LayerHostingMode layerHostingMode() const { return m_layerHostingMode; }
</span><del>- void setLayerHostingMode(unsigned);
</del><ins>+ void setLayerHostingMode(LayerHostingMode);
</ins><span class="cx">
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx"> void updatePluginsActiveAndFocusedState();
</span></span></pre></div>
<a id="branchessafari602branchSourceWebKit2WebProcessWebPageWebPagemessagesin"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (206050 => 206051)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in        2016-09-16 21:42:58 UTC (rev 206050)
+++ branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in        2016-09-16 21:43:02 UTC (rev 206051)
</span><span class="lines">@@ -23,7 +23,7 @@
</span><span class="cx"> messages -> WebPage LegacyReceiver {
</span><span class="cx"> SetInitialFocus(bool forward, bool isKeyboardEventValid, WebKit::WebKeyboardEvent event, uint64_t callbackID)
</span><span class="cx"> SetViewState(unsigned viewState, bool wantsDidUpdateViewState, Vector<uint64_t> callbackIDs)
</span><del>- SetLayerHostingMode(unsigned layerHostingMode)
</del><ins>+ SetLayerHostingMode(enum WebKit::LayerHostingMode layerHostingMode)
</ins><span class="cx">
</span><span class="cx"> SetSessionID(WebCore::SessionID sessionID)
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>