Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(551)

Unified Diff: Source/core/inspector/CodeGeneratorInspectorStrings.py

Issue 48743004: Move InspectorBackendDispatcher::commandNames array from .data to .rodata section (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Reenable compile assertion Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/inspector/CodeGeneratorInspector.py ('k') | Source/web/WebDevToolsAgentImpl.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/CodeGeneratorInspectorStrings.py
diff --git a/Source/core/inspector/CodeGeneratorInspectorStrings.py b/Source/core/inspector/CodeGeneratorInspectorStrings.py
index e0f5262d488c5dee84172fb15c4ad6c244c9dac6..bc3bb739e194c0e8a60c41c89a288136f3bc7253 100644
--- a/Source/core/inspector/CodeGeneratorInspectorStrings.py
+++ b/Source/core/inspector/CodeGeneratorInspectorStrings.py
@@ -60,7 +60,7 @@ $methodInCode
$errorCook${responseCook}
}
- sendResponse(callId, result, commandNames[$commandNameIndex], protocolErrors, error, resultErrorData);
+ sendResponse(callId, result, commandName($commandNameIndex), protocolErrors, error, resultErrorData);
}
""")
@@ -196,7 +196,11 @@ $methodNamesEnumContent
kMethodNamesEnumSize
};
- static const char* commandNames[];
+ static const char* commandName(MethodNames);
+
+private:
+ static const char commandNames[];
+ static const size_t commandNamesIndex[];
};
} // namespace WebCore
@@ -220,10 +224,18 @@ backend_cpp = (
namespace WebCore {
-const char* InspectorBackendDispatcher::commandNames[] = {
+const char InspectorBackendDispatcher::commandNames[] = {
$methodNameDeclarations
};
+const size_t InspectorBackendDispatcher::commandNamesIndex[] = {
+$methodNameDeclarationsIndex
+};
+
+const char* InspectorBackendDispatcher::commandName(MethodNames index) {
+ COMPILE_ASSERT(static_cast<int>(kMethodNamesEnumSize) == WTF_ARRAY_LENGTH(commandNamesIndex), command_name_array_problem);
+ return commandNames + commandNamesIndex[index];
+}
class InspectorBackendDispatcherImpl : public InspectorBackendDispatcher {
public:
@@ -281,9 +293,8 @@ void InspectorBackendDispatcherImpl::dispatch(const String& message)
static CallHandler handlers[] = {
$messageHandlers
};
- size_t length = WTF_ARRAY_LENGTH(commandNames);
- for (size_t i = 0; i < length; ++i)
- dispatchMap.add(commandNames[i], handlers[i]);
+ for (size_t i = 0; i < kMethodNamesEnumSize; ++i)
+ dispatchMap.add(commandName(static_cast<MethodNames>(i)), handlers[i]);
}
RefPtr<JSONValue> parsedMessage = parseJSON(message);
@@ -503,8 +514,6 @@ void InspectorBackendDispatcher::CallbackBase::sendIfActive(PassRefPtr<JSONObjec
m_alreadySent = true;
}
-COMPILE_ASSERT(static_cast<int>(InspectorBackendDispatcher::kMethodNamesEnumSize) == WTF_ARRAY_LENGTH(InspectorBackendDispatcher::commandNames), command_name_array_problem);
-
} // namespace WebCore
""")
« no previous file with comments | « Source/core/inspector/CodeGeneratorInspector.py ('k') | Source/web/WebDevToolsAgentImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698