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

Unified Diff: src/IceBrowserCompileServer.cpp

Issue 1052833003: First attempt to capture parser/translation errors in browser. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years, 8 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 | « src/IceBrowserCompileServer.h ('k') | src/IceGlobalContext.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceBrowserCompileServer.cpp
diff --git a/src/IceBrowserCompileServer.cpp b/src/IceBrowserCompileServer.cpp
index 85c2efe89ebc11ea1530bd54c89111a747744686..fb8ce1d505a633799c356f11e5998e2a9f57f140 100644
--- a/src/IceBrowserCompileServer.cpp
+++ b/src/IceBrowserCompileServer.cpp
@@ -81,7 +81,13 @@ char *onEndCallback() {
// TODO(jvoung): Also return an error string, and UMA data.
// Set up a report_fatal_error handler to grab that string.
if (gCompileServer->getErrorCode().value()) {
- return strdup("Some error occurred");
+ std::string Message("Some error occurred");
+ if (ErrorStream) {
jvoung (off chromium) 2015/04/17 18:15:09 ErrorStream *should* be non-null at this point, si
Karl 2015/04/17 21:33:52 I agree that it shouldn't be null. I wasn't 100% s
+ std::string Error = ErrorStream->getContents();
+ if (!Error.empty())
+ Message = Error;
+ }
+ return strdup(Message);
jvoung (off chromium) 2015/04/17 18:15:09 strdup is usually given the c_str() -- or am I mis
Karl 2015/04/17 21:33:52 My bad. Fixing.
}
return nullptr;
}
@@ -142,9 +148,10 @@ void BrowserCompileServer::startCompileThread(int ObjFD) {
LogStream->SetUnbuffered();
EmitStream = getOutputStream(ObjFD);
EmitStream->SetBufferSize(1 << 14);
+ ErrorStream = new StringStream();
ELFStream.reset(new ELFStreamer(*EmitStream.get()));
Ctx.reset(new GlobalContext(LogStream.get(), EmitStream.get(),
- ELFStream.get(), Flags));
+ ELFStream.get(), Flags. ErrorStream.getStream()));
jvoung (off chromium) 2015/04/17 18:15:09 Should that be a comma instead of a period? Might
Karl 2015/04/17 21:33:52 Fixed, and moved the streams into a group.
CompileThread = std::thread([this]() {
Ctx->initParserThread();
this->getCompiler().run(ExtraFlags, *Ctx.get(),
« no previous file with comments | « src/IceBrowserCompileServer.h ('k') | src/IceGlobalContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698