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

Unified Diff: base/android/library_loader/library_prefetcher.h

Issue 1647803004: Move base to DEPS (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 11 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: base/android/library_loader/library_prefetcher.h
diff --git a/base/android/library_loader/library_prefetcher.h b/base/android/library_loader/library_prefetcher.h
deleted file mode 100644
index 64e5e1ecb4b786f6e8c8ad159262c64c6e69ff17..0000000000000000000000000000000000000000
--- a/base/android/library_loader/library_prefetcher.h
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright 2015 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.
-
-#ifndef BASE_ANDROID_LIBRARY_LOADER_LIBRARY_PREFETCHER_H_
-#define BASE_ANDROID_LIBRARY_LOADER_LIBRARY_PREFETCHER_H_
-
-#include <jni.h>
-
-#include <stdint.h>
-#include <string>
-
-#include "base/debug/proc_maps_linux.h"
-#include "base/gtest_prod_util.h"
-
-namespace base {
-namespace android {
-
-// Forks and waits for a process prefetching the native library. This is done in
-// a forked process for the following reasons:
-// - Isolating the main process from mistakes in the parsing. If the parsing
-// returns an incorrect address, only the forked process will crash.
-// - Not inflating the memory used by the main process uselessly, which could
-// increase its likelihood to be killed.
-// The forked process has background priority and, since it is not declared to
-// the Android runtime, can be killed at any time, which is not an issue here.
-class BASE_EXPORT NativeLibraryPrefetcher {
- public:
- // Finds the ranges matching the native library, forks a low priority
- // process pre-fetching these ranges and wait()s for it.
- // Returns true for success.
- static bool ForkAndPrefetchNativeLibrary();
-
- private:
- using AddressRange = std::pair<uintptr_t, uintptr_t>;
- // Returns true if the region matches native code or data.
- static bool IsGoodToPrefetch(const base::debug::MappedMemoryRegion& region);
- // Filters the regions to keep only libchrome ranges if possible.
- static void FilterLibchromeRangesOnlyIfPossible(
- const std::vector<base::debug::MappedMemoryRegion>& regions,
- std::vector<AddressRange>* ranges);
- // Finds the ranges matching the native library in /proc/self/maps.
- // Returns true for success.
- static bool FindRanges(std::vector<AddressRange>* ranges);
-
- FRIEND_TEST_ALL_PREFIXES(NativeLibraryPrefetcherTest,
- TestIsGoodToPrefetchNoRange);
- FRIEND_TEST_ALL_PREFIXES(NativeLibraryPrefetcherTest,
- TestIsGoodToPrefetchUnreadableRange);
- FRIEND_TEST_ALL_PREFIXES(NativeLibraryPrefetcherTest,
- TestIsGoodToPrefetchSkipSharedRange);
- FRIEND_TEST_ALL_PREFIXES(NativeLibraryPrefetcherTest,
- TestIsGoodToPrefetchLibchromeRange);
- FRIEND_TEST_ALL_PREFIXES(NativeLibraryPrefetcherTest,
- TestIsGoodToPrefetchBaseApkRange);
- FRIEND_TEST_ALL_PREFIXES(NativeLibraryPrefetcherTest,
- TestFilterLibchromeRangesOnlyIfPossibleNoLibchrome);
- FRIEND_TEST_ALL_PREFIXES(NativeLibraryPrefetcherTest,
- TestFilterLibchromeRangesOnlyIfPossibleHasLibchrome);
-
- DISALLOW_IMPLICIT_CONSTRUCTORS(NativeLibraryPrefetcher);
-};
-
-} // namespace android
-} // namespace base
-
-#endif // BASE_ANDROID_LIBRARY_LOADER_LIBRARY_PREFETCHER_H_
« no previous file with comments | « base/android/library_loader/library_loader_hooks.cc ('k') | base/android/library_loader/library_prefetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698