| Index: base/mac/foundation_util.mm
|
| diff --git a/base/mac/foundation_util.mm b/base/mac/foundation_util.mm
|
| index 4e9b2248874c33959e40cceb0157099c6759b522..2895b66381259f727928798ac6f34fd4b90b8253 100644
|
| --- a/base/mac/foundation_util.mm
|
| +++ b/base/mac/foundation_util.mm
|
| @@ -26,6 +26,8 @@ namespace mac {
|
|
|
| namespace {
|
|
|
| +bool g_cached_am_i_bundled_called = false;
|
| +bool g_cached_am_i_bundled_value = false;
|
| bool g_override_am_i_bundled = false;
|
| bool g_override_am_i_bundled_value = false;
|
|
|
| @@ -48,12 +50,15 @@ bool AmIBundled() {
|
| // If the return value is not cached, this function will return different
|
| // values depending on when it's called. This confuses some client code, see
|
| // http://crbug.com/63183 .
|
| - static bool result = UncachedAmIBundled();
|
| - DCHECK_EQ(result, UncachedAmIBundled())
|
| + if (!g_cached_am_i_bundled_called) {
|
| + g_cached_am_i_bundled_called = true;
|
| + g_cached_am_i_bundled_value = UncachedAmIBundled();
|
| + }
|
| + DCHECK_EQ(g_cached_am_i_bundled_value, UncachedAmIBundled())
|
| << "The return value of AmIBundled() changed. This will confuse tests. "
|
| << "Call SetAmIBundled() override manually if your test binary "
|
| << "delay-loads the framework.";
|
| - return result;
|
| + return g_cached_am_i_bundled_value;
|
| }
|
|
|
| void SetOverrideAmIBundled(bool value) {
|
| @@ -66,6 +71,10 @@ void SetOverrideAmIBundled(bool value) {
|
| g_override_am_i_bundled_value = value;
|
| }
|
|
|
| +BASE_EXPORT void ClearAmIBundledCache() {
|
| + g_cached_am_i_bundled_called = false;
|
| +}
|
| +
|
| bool IsBackgroundOnlyProcess() {
|
| // This function really does want to examine NSBundle's idea of the main
|
| // bundle dictionary. It needs to look at the actual running .app's
|
|
|