Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | package org.mozilla.gecko.background.sync.helpers; |
michael@0 | 5 | |
michael@0 | 6 | import java.util.concurrent.ExecutorService; |
michael@0 | 7 | |
michael@0 | 8 | import org.mozilla.gecko.sync.repositories.delegates.RepositorySessionStoreDelegate; |
michael@0 | 9 | |
michael@0 | 10 | public class DefaultStoreDelegate extends DefaultDelegate implements RepositorySessionStoreDelegate { |
michael@0 | 11 | |
michael@0 | 12 | @Override |
michael@0 | 13 | public void onRecordStoreFailed(Exception ex, String guid) { |
michael@0 | 14 | performNotify("Store failed", ex); |
michael@0 | 15 | } |
michael@0 | 16 | |
michael@0 | 17 | @Override |
michael@0 | 18 | public void onRecordStoreSucceeded(String guid) { |
michael@0 | 19 | performNotify("DefaultStoreDelegate used", null); |
michael@0 | 20 | } |
michael@0 | 21 | |
michael@0 | 22 | @Override |
michael@0 | 23 | public void onStoreCompleted(long storeEnd) { |
michael@0 | 24 | performNotify("DefaultStoreDelegate used", null); |
michael@0 | 25 | } |
michael@0 | 26 | |
michael@0 | 27 | @Override |
michael@0 | 28 | public RepositorySessionStoreDelegate deferredStoreDelegate(final ExecutorService executor) { |
michael@0 | 29 | final RepositorySessionStoreDelegate self = this; |
michael@0 | 30 | return new RepositorySessionStoreDelegate() { |
michael@0 | 31 | |
michael@0 | 32 | @Override |
michael@0 | 33 | public void onRecordStoreSucceeded(final String guid) { |
michael@0 | 34 | executor.execute(new Runnable() { |
michael@0 | 35 | @Override |
michael@0 | 36 | public void run() { |
michael@0 | 37 | self.onRecordStoreSucceeded(guid); |
michael@0 | 38 | } |
michael@0 | 39 | }); |
michael@0 | 40 | } |
michael@0 | 41 | |
michael@0 | 42 | @Override |
michael@0 | 43 | public void onRecordStoreFailed(final Exception ex, final String guid) { |
michael@0 | 44 | executor.execute(new Runnable() { |
michael@0 | 45 | @Override |
michael@0 | 46 | public void run() { |
michael@0 | 47 | self.onRecordStoreFailed(ex, guid); |
michael@0 | 48 | } |
michael@0 | 49 | }); |
michael@0 | 50 | } |
michael@0 | 51 | |
michael@0 | 52 | @Override |
michael@0 | 53 | public void onStoreCompleted(final long storeEnd) { |
michael@0 | 54 | executor.execute(new Runnable() { |
michael@0 | 55 | @Override |
michael@0 | 56 | public void run() { |
michael@0 | 57 | self.onStoreCompleted(storeEnd); |
michael@0 | 58 | } |
michael@0 | 59 | }); |
michael@0 | 60 | } |
michael@0 | 61 | |
michael@0 | 62 | @Override |
michael@0 | 63 | public RepositorySessionStoreDelegate deferredStoreDelegate(ExecutorService newExecutor) { |
michael@0 | 64 | if (newExecutor == executor) { |
michael@0 | 65 | return this; |
michael@0 | 66 | } |
michael@0 | 67 | throw new IllegalArgumentException("Can't re-defer this delegate."); |
michael@0 | 68 | } |
michael@0 | 69 | }; |
michael@0 | 70 | } |
michael@0 | 71 | } |