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

Unified Diff: trunk/src/tools/gn/standard_out.cc

Issue 21084010: Revert 214254 "Add initial prototype for the GN meta-buildsystem." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 5 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 | « trunk/src/tools/gn/standard_out.h ('k') | trunk/src/tools/gn/string_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/tools/gn/standard_out.cc
===================================================================
--- trunk/src/tools/gn/standard_out.cc (revision 214322)
+++ trunk/src/tools/gn/standard_out.cc (working copy)
@@ -1,84 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "tools/gn/standard_out.h"
-
-#include "build/build_config.h"
-
-#if defined(OS_WIN)
-#include <windows.h>
-#else
-#include <stdio.h>
-#endif
-
-namespace {
-
-bool initialized = false;
-
-#if defined(OS_WIN)
-HANDLE hstdout;
-WORD default_attributes;
-
-bool is_console = false;
-#endif
-
-void EnsureInitialized() {
- if (initialized)
- return;
- initialized = true;
-
-#if defined(OS_WIN)
- hstdout = ::GetStdHandle(STD_OUTPUT_HANDLE);
- CONSOLE_SCREEN_BUFFER_INFO info;
- is_console = !!::GetConsoleScreenBufferInfo(hstdout, &info);
- default_attributes = info.wAttributes;
-#endif
-}
-
-} // namespace
-
-#if defined(OS_WIN)
-
-void OutputString(const std::string& output, TextDecoration dec) {
- EnsureInitialized();
- if (is_console) {
- switch (dec) {
- case DECORATION_NONE:
- break;
- case DECORATION_BOLD:
- ::SetConsoleTextAttribute(hstdout, FOREGROUND_INTENSITY);
- break;
- case DECORATION_RED:
- ::SetConsoleTextAttribute(hstdout,
- FOREGROUND_RED | FOREGROUND_INTENSITY);
- break;
- case DECORATION_GREEN:
- // Keep green non-bold.
- ::SetConsoleTextAttribute(hstdout, FOREGROUND_GREEN);
- break;
- case DECORATION_BLUE:
- ::SetConsoleTextAttribute(hstdout,
- FOREGROUND_BLUE | FOREGROUND_INTENSITY);
- break;
- case DECORATION_YELLOW:
- ::SetConsoleTextAttribute(hstdout,
- FOREGROUND_RED | FOREGROUND_GREEN);
- break;
- }
- }
-
- DWORD written = 0;
- ::WriteFile(hstdout, output.c_str(), output.size(), &written, NULL);
-
- if (is_console)
- ::SetConsoleTextAttribute(hstdout, default_attributes);
-}
-
-#else
-
-void OutputString(const std::string& output, TextDecoration dec) {
- printf("%s", output.c_str());
-}
-
-#endif
« no previous file with comments | « trunk/src/tools/gn/standard_out.h ('k') | trunk/src/tools/gn/string_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698