// queue has been cleared,they are ignored.
private boolean mBlockMessages = false;
private int mOrientation = -1;
- private static String sDatabaseDirectory;
- private static String sCacheDirectory;
// Is this frame the main frame?
private boolean mIsMainFrame;
AssetManager am = context.getAssets();
nativeCreateFrame(w, am, proxy.getBackForwardList());
- if (sDatabaseDirectory == null) {
- sDatabaseDirectory = appContext.getDatabasePath("dummy").getParent();
- }
- if (sCacheDirectory == null) {
- sCacheDirectory = appContext.getCacheDir().getAbsolutePath();
- }
-
if (DebugFlags.BROWSER_FRAME) {
Log.v(LOGTAG, "BrowserFrame constructor: this=" + this);
}
}
/**
- * Called by JNI. Gets the application's database directory, excluding the trailing slash.
- * @return String The application's database directory
- */
- private static String getDatabaseDirectory() {
- return sDatabaseDirectory;
- }
-
- /**
- * Called by JNI. Gets the application's cache directory, excluding the trailing slash.
- * @return String The application's cache directory
- */
- private static String getCacheDirectory() {
- return sCacheDirectory;
- }
-
- /**
* Called by JNI.
* Read from an InputStream into a supplied byte[]
* This method catches any exceptions so they don't crash the JVM.
// time when last update happened
private long mLastUpdate;
+ // Used by the Chromium HTTP stack. Everything else in this class is used only by the Android
+ // Java HTTP stack.
+ private static String sDatabaseDirectory;
+ private static String sCacheDirectory;
+
private CookieSyncManager(Context context) {
super(context, "CookieSyncManager");
}
* @return CookieSyncManager
*/
public static synchronized CookieSyncManager getInstance() {
- if (sRef == null) {
- throw new IllegalStateException(
- "CookieSyncManager::createInstance() needs to be called "
- + "before CookieSyncManager::getInstance()");
- }
+ checkInstanceIsCreated();
return sRef;
}
*/
public static synchronized CookieSyncManager createInstance(
Context context) {
+ Context appContext = context.getApplicationContext();
if (sRef == null) {
- sRef = new CookieSyncManager(context.getApplicationContext());
+ sRef = new CookieSyncManager(appContext);
+ sDatabaseDirectory = appContext.getDatabasePath("dummy").getParent();
+ sCacheDirectory = appContext.getCacheDir().getAbsolutePath();
}
return sRef;
}
}
}
}
+
+ private static void checkInstanceIsCreated() {
+ if (sRef == null) {
+ throw new IllegalStateException(
+ "CookieSyncManager::createInstance() needs to be called "
+ + "before CookieSyncManager::getInstance()");
+ }
+ }
+
+ /**
+ * Called by JNI. Gets the application's database directory, excluding the trailing slash.
+ * @return String The application's database directory
+ */
+ private static synchronized String getDatabaseDirectory() {
+ checkInstanceIsCreated();
+ return sDatabaseDirectory;
+ }
+
+ /**
+ * Called by JNI. Gets the application's cache directory, excluding the trailing slash.
+ * @return String The application's cache directory
+ */
+ private static synchronized String getCacheDirectory() {
+ checkInstanceIsCreated();
+ return sCacheDirectory;
+ }
}