diff options
| author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-12 14:27:29 +0200 |
|---|---|---|
| committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-13 09:35:20 +0000 |
| commit | c30a6232df03e1efbd9f3b226777b07e087a1122 (patch) | |
| tree | e992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/v8/src/diagnostics/code-tracer.h | |
| parent | 7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff) | |
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/v8/src/diagnostics/code-tracer.h')
| -rw-r--r-- | chromium/v8/src/diagnostics/code-tracer.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/chromium/v8/src/diagnostics/code-tracer.h b/chromium/v8/src/diagnostics/code-tracer.h index a9f276bf448..194d3cbe667 100644 --- a/chromium/v8/src/diagnostics/code-tracer.h +++ b/chromium/v8/src/diagnostics/code-tracer.h @@ -5,9 +5,11 @@ #ifndef V8_DIAGNOSTICS_CODE_TRACER_H_ #define V8_DIAGNOSTICS_CODE_TRACER_H_ +#include "src/base/optional.h" #include "src/common/globals.h" #include "src/flags/flags.h" #include "src/utils/allocation.h" +#include "src/utils/ostreams.h" #include "src/utils/utils.h" #include "src/utils/vector.h" @@ -45,6 +47,28 @@ class CodeTracer final : public Malloced { CodeTracer* tracer_; }; + class StreamScope : public Scope { + public: + explicit StreamScope(CodeTracer* tracer) : Scope(tracer) { + FILE* file = this->file(); + if (file == stdout) { + stdout_stream_.emplace(); + } else { + file_stream_.emplace(file); + } + } + + std::ostream& stream() { + if (stdout_stream_.has_value()) return stdout_stream_.value(); + return file_stream_.value(); + } + + private: + // Exactly one of these two will be initialized. + base::Optional<StdoutStream> stdout_stream_; + base::Optional<OFStream> file_stream_; + }; + void OpenFile() { if (!ShouldRedirect()) { return; |
