Bug 1258789 - Add synchronized & non-failing try to WhitespaceAround. r=grisha

MozReview-Commit-ID: EBnxF8j2eeY

--HG--
extra : rebase_source : e5f79e706f7ba63b484baf5b339581cdbeee626d
This commit is contained in:
Michael Comella 2016-04-12 18:20:51 -07:00
Родитель b7ca9be873
Коммит 536223b0e1
10 изменённых файлов: 21 добавлений и 21 удалений

Просмотреть файл

@ -55,7 +55,7 @@
</module>
<module name="WhitespaceAround">
<property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN,
LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SWITCH"/>
LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY"/>
</module>
</module>

Просмотреть файл

@ -1492,7 +1492,7 @@ public class GeckoAppShell
List<ResolveInfo> plugins = pm.queryIntentServices(new Intent(PLUGIN_ACTION),
PackageManager.GET_SERVICES | PackageManager.GET_META_DATA);
synchronized(mPackageInfoCache) {
synchronized (mPackageInfoCache) {
// clear the list of existing packageInfo objects
mPackageInfoCache.clear();
@ -1619,7 +1619,7 @@ public class GeckoAppShell
return null;
}
synchronized(mPackageInfoCache) {
synchronized (mPackageInfoCache) {
for (PackageInfo pkgInfo : mPackageInfoCache) {
if (pluginLib.contains(pkgInfo.packageName)) {
return pkgInfo.packageName;

Просмотреть файл

@ -253,7 +253,7 @@ final class GeckoEditable extends JNIObject
if (mActions.isEmpty()) {
mActionsActive.acquireUninterruptibly();
mActions.offer(action);
} else synchronized(this) {
} else synchronized (this) {
// tryAcquire here in case Gecko thread has just released it
mActionsActive.tryAcquire();
mActions.offer(action);
@ -350,7 +350,7 @@ final class GeckoEditable extends JNIObject
throw new IllegalStateException("empty actions queue");
}
synchronized(this) {
synchronized (this) {
if (mActions.isEmpty()) {
mActionsActive.release();
}

Просмотреть файл

@ -763,25 +763,25 @@ public class Tab {
}
public void addPluginLayer(Object surfaceOrView, Layer layer) {
synchronized(mPluginLayers) {
synchronized (mPluginLayers) {
mPluginLayers.put(surfaceOrView, layer);
}
}
public Layer getPluginLayer(Object surfaceOrView) {
synchronized(mPluginLayers) {
synchronized (mPluginLayers) {
return mPluginLayers.get(surfaceOrView);
}
}
public Collection<Layer> getPluginLayers() {
synchronized(mPluginLayers) {
synchronized (mPluginLayers) {
return new ArrayList<Layer>(mPluginLayers.values());
}
}
public Layer removePluginLayer(Object surfaceOrView) {
synchronized(mPluginLayers) {
synchronized (mPluginLayers) {
return mPluginLayers.remove(surfaceOrView);
}
}

Просмотреть файл

@ -296,7 +296,7 @@ public class Favicons {
final LoadFaviconTask task =
new LoadFaviconTask(context, pageURL, targetURL, 0, callback, targetSize, true);
final int taskId = task.getId();
synchronized(loadTasks) {
synchronized (loadTasks) {
loadTasks.put(taskId, task);
}
task.execute();
@ -369,7 +369,7 @@ public class Favicons {
final LoadFaviconTask task =
new LoadFaviconTask(context, pageURL, faviconURL, flags, listener, targetSize, false);
final int taskId = task.getId();
synchronized(loadTasks) {
synchronized (loadTasks) {
loadTasks.put(taskId, task);
}
task.execute();
@ -567,7 +567,7 @@ public class Favicons {
}
public static void removeLoadTask(int taskId) {
synchronized(loadTasks) {
synchronized (loadTasks) {
loadTasks.delete(taskId);
}
}

Просмотреть файл

@ -381,7 +381,7 @@ public class LoadFaviconTask {
Bitmap image;
// Determine if there is already an ongoing task to fetch the Favicon we desire.
// If there is, just join the queue and wait for it to finish. If not, we carry on.
synchronized(loadsInFlight) {
synchronized (loadsInFlight) {
// Another load of the current Favicon is already underway
LoadFaviconTask existingTask = loadsInFlight.get(faviconURL);
if (existingTask != null && !existingTask.isCancelled()) {
@ -565,7 +565,7 @@ public class LoadFaviconTask {
void onCancelled() {
Favicons.removeLoadTask(id);
synchronized(loadsInFlight) {
synchronized (loadsInFlight) {
// Only remove from the hashmap if the task there is the one that's being canceled.
// Cancellation of a task that would have chained is not interesting to the hashmap.
final LoadFaviconTask primary = loadsInFlight.get(faviconURL);

Просмотреть файл

@ -451,7 +451,7 @@ public class FaviconCache {
* @return true if this element already existed in the list, false otherwise. (Useful for preventing multiple-insertion.)
*/
private boolean setMostRecentlyUsedWithinRead(FaviconCacheElement element) {
synchronized(reorderingLock) {
synchronized (reorderingLock) {
boolean contained = ordering.remove(element);
ordering.offer(element);
return contained;

Просмотреть файл

@ -326,7 +326,7 @@ public class HomePanelsManager implements GeckoEventListener {
pm.requestPanelsById(ids, new RequestCallback() {
@Override
public void onComplete(List<PanelInfo> panelInfos) {
synchronized(panelRequestLock) {
synchronized (panelRequestLock) {
latestPanelInfos.addAll(panelInfos);
Log.d(LOGTAG, "executeRefresh: fetched panel infos: " + panelInfos.size());
@ -336,7 +336,7 @@ public class HomePanelsManager implements GeckoEventListener {
});
try {
synchronized(panelRequestLock) {
synchronized (panelRequestLock) {
panelRequestLock.wait(PANEL_INFO_TIMEOUT_MSEC);
Log.d(LOGTAG, "executeRefresh: done fetching panel infos");

Просмотреть файл

@ -75,7 +75,7 @@ public class PanelInfoManager implements GeckoEventListener {
public void requestPanelsById(Set<String> ids, RequestCallback callback) {
final int requestId = sRequestId.getAndIncrement();
synchronized(sCallbacks) {
synchronized (sCallbacks) {
// If there are no pending callbacks, register the event listener.
if (sCallbacks.size() == 0) {
EventDispatcher.getInstance().registerGeckoThreadListener(this,
@ -131,7 +131,7 @@ public class PanelInfoManager implements GeckoEventListener {
final RequestCallback callback;
final int requestId = message.getInt("requestId");
synchronized(sCallbacks) {
synchronized (sCallbacks) {
callback = sCallbacks.get(requestId);
sCallbacks.delete(requestId);

Просмотреть файл

@ -39,7 +39,7 @@ public class JavaAddonManagerV1 implements NativeEventListener {
private final org.mozilla.gecko.EventDispatcher mDispatcher;
// Protected by synchronized(this).
// Protected by synchronized (this).
private final Map<String, EventDispatcherImpl> mGUIDToDispatcherMap = new HashMap<>();
public static synchronized JavaAddonManagerV1 getInstance() {
@ -153,7 +153,7 @@ public class JavaAddonManagerV1 implements NativeEventListener {
private final String guid;
private final String dexFileName;
// Protected by synchronized(this).
// Protected by synchronized (this).
private final Map<JavaAddonInterfaceV1.EventListener, Pair<NativeEventListener, String[]>> mListenerToWrapperMap = new IdentityHashMap<>();
public EventDispatcherImpl(String guid, String dexFileName) {