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

Unified Diff: Source/WebCore/inspector/CodeGeneratorInspector.pm

Issue 7062044: Merge 86507 - 2011-05-15 Ilya Tikhonovsky <loislo@chromium.org> (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/742/
Patch Set: Created 9 years, 7 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 | « LayoutTests/platform/win/Skipped ('k') | Source/WebCore/inspector/InspectorController.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/inspector/CodeGeneratorInspector.pm
===================================================================
--- Source/WebCore/inspector/CodeGeneratorInspector.pm (revision 87486)
+++ Source/WebCore/inspector/CodeGeneratorInspector.pm (working copy)
@@ -93,6 +93,9 @@
$typeTransform{"PassRefPtr"} = {
"forwardHeader" => "wtf/PassRefPtr.h",
};
+$typeTransform{"RefCounted"} = {
+ "forwardHeader" => "wtf/RefCounted.h",
+};
$typeTransform{"InspectorFrontendChannel"} = {
"forward" => "InspectorFrontendChannel",
"header" => "InspectorFrontendChannel.h",
@@ -213,6 +216,7 @@
my $namespace;
my $backendClassName;
+my $backendClassDeclaration;
my $backendJSStubName;
my %backendTypes;
my @backendMethods;
@@ -273,10 +277,12 @@
$frontendTypes{"PassRefPtr"} = 1;
$backendClassName = "InspectorBackendDispatcher";
+ $backendClassDeclaration = "InspectorBackendDispatcher: public RefCounted<InspectorBackendDispatcher>";
$backendJSStubName = "InspectorBackendStub";
$backendTypes{"Inspector"} = 1;
$backendTypes{"InspectorFrontendChannel"} = 1;
$backendTypes{"PassRefPtr"} = 1;
+ $backendTypes{"RefCounted"} = 1;
$backendTypes{"Object"} = 1;
}
@@ -384,7 +390,8 @@
}
push(@function, " ${functionName}Message->setObject(\"params\", paramsObject);");
}
- push(@function, " m_inspectorFrontendChannel->sendMessageToFrontend(${functionName}Message->toJSONString());");
+ push(@function, " if (m_inspectorFrontendChannel)");
+ push(@function, " m_inspectorFrontendChannel->sendMessageToFrontend(${functionName}Message->toJSONString());");
push(@function, "}");
push(@function, "");
push(@frontendMethodsImpl, @function);
@@ -489,7 +496,8 @@
push(@function, " responseMessage->setObject(\"result\", result);");
push(@function, "");
push(@function, " responseMessage->setNumber(\"id\", callId);");
- push(@function, " m_inspectorFrontendChannel->sendMessageToFrontend(responseMessage->toJSONString());");
+ push(@function, " if (m_inspectorFrontendChannel)");
+ push(@function, " m_inspectorFrontendChannel->sendMessageToFrontend(responseMessage->toJSONString());");
push(@function, "}");
push(@function, "");
push(@backendMethodsImpl, @function);
@@ -530,7 +538,8 @@
message->setNumber("id", *callId);
else
message->setValue("id", InspectorValue::null());
- m_inspectorFrontendChannel->sendMessageToFrontend(message->toJSONString());
+ if (m_inspectorFrontendChannel)
+ m_inspectorFrontendChannel->sendMessageToFrontend(message->toJSONString());
}
EOF
return split("\n", $reportProtocolError);
@@ -581,6 +590,7 @@
my $backendDispatcherBody = << "EOF";
void ${backendClassName}::dispatch(const String& message)
{
+ RefPtr<${backendClassName}> protect = this;
typedef void (${backendClassName}::*CallHandler)(long callId, InspectorObject* messageObject);
typedef HashMap<String, CallHandler> DispatchMap;
DEFINE_STATIC_LOCAL(DispatchMap, dispatchMap, );
@@ -880,6 +890,7 @@
sub generateHeader
{
my $className = shift;
+ my $classDeclaration = shift;
my $types = shift;
my $constructor = shift;
my $constants = shift;
@@ -906,7 +917,7 @@
typedef String ErrorString;
-class $className {
+class $classDeclaration {
public:
$constructor
@@ -993,6 +1004,8 @@
push(@backendHead, @fieldInitializers);
push(@backendHead, " { }");
push(@backendHead, "");
+ push(@backendHead, " void clearFrontend() { m_inspectorFrontendChannel = 0; }");
+ push(@backendHead, "");
push(@backendHead, " enum CommonErrorCode {");
push(@backendHead, " ParseError = 0,");
push(@backendHead, " InvalidRequest,");
@@ -1024,7 +1037,7 @@
undef($SOURCE);
open(my $HEADER, ">$outputHeadersDir/$frontendClassName.h") || die "Couldn't open file $outputHeadersDir/$frontendClassName.h";
- print $HEADER generateHeader($frontendClassName, \%frontendTypes, $frontendConstructor, \@frontendConstantDeclarations, \@frontendMethods, join("\n", @frontendFooter));
+ print $HEADER generateHeader($frontendClassName, $frontendClassName, \%frontendTypes, $frontendConstructor, \@frontendConstantDeclarations, \@frontendMethods, join("\n", @frontendFooter));
close($HEADER);
undef($HEADER);
@@ -1050,7 +1063,7 @@
undef($SOURCE);
open($HEADER, ">$outputHeadersDir/$backendClassName.h") || die "Couldn't open file $outputHeadersDir/$backendClassName.h";
- print $HEADER join("\n", generateHeader($backendClassName, \%backendTypes, $backendConstructor, \@backendConstantDeclarations, \@backendMethods, join("\n", @backendFooter)));
+ print $HEADER join("\n", generateHeader($backendClassName, $backendClassDeclaration, \%backendTypes, $backendConstructor, \@backendConstantDeclarations, \@backendMethods, join("\n", @backendFooter)));
close($HEADER);
undef($HEADER);
« no previous file with comments | « LayoutTests/platform/win/Skipped ('k') | Source/WebCore/inspector/InspectorController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698