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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebEnvironment.java

Issue 1955173003: Test thread equality when initiating PWEnv class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 7 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
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/physicalweb/ListUrlsActivityTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebEnvironment.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebEnvironment.java b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebEnvironment.java
index 26655d3e0a1233d0bea741edd50e8f661e668c2d..1974889950e09e257522b3be5bcc96c19271c828 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebEnvironment.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebEnvironment.java
@@ -4,13 +4,13 @@
package org.chromium.chrome.browser.physicalweb;
-import org.chromium.base.ThreadUtils;
import org.chromium.chrome.browser.ChromeApplication;
/**
* Tool that reports information about conflicting clients.
*/
public class PhysicalWebEnvironment {
+ private static final Object INSTANCE_LOCK = new Object();
private static PhysicalWebEnvironment sInstance = null;
/**
@@ -20,9 +20,10 @@ public class PhysicalWebEnvironment {
* @return an instance of this class (or subclass) as decided by the application parameter
*/
public static PhysicalWebEnvironment getInstance(ChromeApplication chromeApplication) {
- ThreadUtils.assertOnUiThread();
- if (sInstance == null) {
- sInstance = chromeApplication.createPhysicalWebEnvironment();
+ synchronized (INSTANCE_LOCK) {
+ if (sInstance == null) {
+ sInstance = chromeApplication.createPhysicalWebEnvironment();
+ }
}
return sInstance;
}
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/physicalweb/ListUrlsActivityTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698