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

Side by Side Diff: third_party/android_crazy_linker/src/src/crazy_linker_globals.h

Issue 322433006: Fork of the Android NDK crazy linker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a required license header to a cpp module, missing in the original. Created 6 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CRAZY_LINKER_GLOBALS_H
6 #define CRAZY_LINKER_GLOBALS_H
7
8 #include <pthread.h>
9
10 #include "crazy_linker_library_list.h"
11 #include "crazy_linker_rdebug.h"
12 #include "crazy_linker_search_path_list.h"
13 #include "crazy_linker_util.h"
14
15 // All crazy linker globals are declared in this header.
16
17 namespace crazy {
18
19 class Globals {
20 public:
21 Globals();
22 ~Globals();
23
24 void Lock() { pthread_mutex_lock(&lock_); }
25
26 void Unlock() { pthread_mutex_unlock(&lock_); }
27
28 static Globals* Get();
29
30 static LibraryList* GetLibraries() { return &Get()->libraries_; }
31
32 static SearchPathList* GetSearchPaths() { return &Get()->search_paths_; }
33
34 static RDebug* GetRDebug() { return &Get()->rdebug_; }
35
36 private:
37 pthread_mutex_t lock_;
38 LibraryList libraries_;
39 SearchPathList search_paths_;
40 RDebug rdebug_;
41 };
42
43 // Helper class to access the globals with scoped locking.
44 class ScopedGlobalLock {
45 public:
46 ScopedGlobalLock() { Globals::Get()->Lock(); }
47
48 ~ScopedGlobalLock() { Globals::Get()->Unlock(); }
49 };
50
51 } // namespace crazy
52
53 #endif // CRAZY_LINKER_GLOBALS_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698