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

Unified Diff: src/IceBrowserCompileServer.h

Issue 1168543002: Use report_fatal_error before destroying input object on error. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 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 | « no previous file | src/IceBrowserCompileServer.cpp » ('j') | src/IceBrowserCompileServer.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceBrowserCompileServer.h
diff --git a/src/IceBrowserCompileServer.h b/src/IceBrowserCompileServer.h
index 1f663c343fd3372a0ca79d22b7ab76d3d400e97b..4075d9d3f27390c37ce5ff92912bee31b676faf4 100644
--- a/src/IceBrowserCompileServer.h
+++ b/src/IceBrowserCompileServer.h
@@ -14,6 +14,7 @@
#ifndef SUBZERO_SRC_ICEBROWSERCOMPILESERVER_H
#define SUBZERO_SRC_ICEBROWSERCOMPILESERVER_H
+#include <atomic>
#include <thread>
#include "IceClFlags.h"
@@ -43,12 +44,14 @@ class BrowserCompileServer : public CompileServer {
public:
explicit BrowserCompileServer(Compiler &Comp)
- : CompileServer(Comp), InputStream(nullptr) {}
+ : CompileServer(Comp), InputStream(nullptr), HadError(false) {}
~BrowserCompileServer() final;
void run() final;
+ ErrorCode &getErrorCode() final;
+
// Parse and set up the flags for compile jobs.
void getParsedFlags(uint32_t NumThreads, int argc, char **argv);
@@ -66,7 +69,8 @@ public:
// Wait for the compile thread to complete then reset the state.
void waitForCompileThread() {
CompileThread.join();
- LastError.assign(Ctx->getErrorStatus()->value());
+ if (Ctx->getErrorStatus()->value())
+ LastError.assign(Ctx->getErrorStatus()->value());
// Reset some state. The InputStream is deleted by the compiler
// so only reset this to nullptr. Free and flush the rest
// of the streams.
@@ -77,6 +81,8 @@ public:
StringStream &getErrorStream() { return *ErrorStream; }
+ void setFatalError(const IceString &Reason);
+
private:
class StringStream {
public:
@@ -102,6 +108,7 @@ private:
ClFlags Flags;
ClFlagsExtra ExtraFlags;
std::thread CompileThread;
+ std::atomic<bool> HadError;
};
} // end of namespace Ice
« no previous file with comments | « no previous file | src/IceBrowserCompileServer.cpp » ('j') | src/IceBrowserCompileServer.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698