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

Side by Side Diff: base/android/linker/crazy_linker/src/crazy_linker_globals.h

Issue 23717023: Android: Add chrome-specific dynamic linker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename library Created 7 years, 3 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() {
25 pthread_mutex_lock(&lock_);
26 }
27
28 void Unlock() {
29 pthread_mutex_unlock(&lock_);
30 }
31
32 static Globals* Get();
33
34 static LibraryList* GetLibraries() {
35 return &Get()->libraries_;
36 }
37
38 static SearchPathList* GetSearchPaths() {
39 return &Get()->search_paths_;
40 }
41
42 static RDebug* GetRDebug() {
43 return &Get()->rdebug_;
44 }
45
46 private:
47 pthread_mutex_t lock_;
48 LibraryList libraries_;
49 SearchPathList search_paths_;
50 RDebug rdebug_;
51 };
52
53 // Helper class to access the globals with scoped locking.
54 class ScopedGlobalLock {
55 public:
56 ScopedGlobalLock() {
57 Globals::Get()->Lock();
58 }
59
60 ~ScopedGlobalLock() {
61 Globals::Get()->Unlock();
62 }
63 };
64
65 } // namespace crazy
66
67 #endif // CRAZY_LINKER_GLOBALS_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698