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

Unified Diff: third_party/android_crazy_linker/src/src/crazy_linker_globals.cpp

Issue 1180693002: Update from https://crrev.com/333737 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebased Created 5 years, 6 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
Index: third_party/android_crazy_linker/src/src/crazy_linker_globals.cpp
diff --git a/third_party/android_crazy_linker/src/src/crazy_linker_globals.cpp b/third_party/android_crazy_linker/src/src/crazy_linker_globals.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..156c19419897fadd5a0ee9f6cd861595f5d17de7
--- /dev/null
+++ b/third_party/android_crazy_linker/src/src/crazy_linker_globals.cpp
@@ -0,0 +1,40 @@
+// Copyright 2014 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 "crazy_linker_globals.h"
+
+#include <pthread.h>
+
+#include "crazy_linker_system.h"
+
+namespace crazy {
+
+namespace {
+
+Globals* g_globals = NULL;
+pthread_once_t g_globals_once = PTHREAD_ONCE_INIT;
+
+void CreateGlobalsInstance() { g_globals = new Globals(); }
+
+} // namespace
+
+Globals::Globals() : search_paths_(), rdebug_() {
+ pthread_mutexattr_t attr;
+ pthread_mutexattr_init(&attr);
+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+ pthread_mutex_init(&lock_, &attr);
+ search_paths_.ResetFromEnv("LD_LIBRARY_PATH");
+}
+
+Globals::~Globals() { pthread_mutex_destroy(&lock_); }
+
+Globals* Globals::Get() {
+ pthread_once(&g_globals_once, CreateGlobalsInstance);
+ return g_globals;
+}
+
+// static
+int Globals::sdk_build_version_ = 0;
+
+} // namespace crazy

Powered by Google App Engine
This is Rietveld 408576698