summaryrefslogtreecommitdiffstats
path: root/content/browser/background_sync/background_sync_manager.cc
Commit message (Collapse)AuthorAgeFilesLines
* Reland of Move BackgroundSyncManager::ErrorType to BackgroundSyncStatusjkarlin2015-08-051-44/+60
| | | | | | | | | | | | | | | | https://codereview.chromium.org/1246483002/ broke the tree due to a conflict with another CL landing at the same time. Move BackgroundSyncManager::ErrorType to BackgroundSyncStatus This needs to be in its own file to prevent dependency loop issues. And it's more of a status than an error code so renaming. TBR=iclelland@chromium.org,mvanouwerkerk@chromium.org BUG=511278 Review URL: https://codereview.chromium.org/1274573003 Cr-Commit-Position: refs/heads/master@{#341895}
* Revert of Move BackgroundSyncManager::ErrorType to BackgroundSyncStatus ↵jkarlin2015-08-041-60/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | (patchset #5 id:80001 of https://codereview.chromium.org/1246483002/ ) Reason for revert: Broken compilation, need to rebase again. Original issue's description: > Move BackgroundSyncManager::ErrorType to BackgroundSyncStatus > > This needs to be in its own file to prevent dependency loop issues. And it's more of a status than an error code so renaming. > > BUG=511278 > > Committed: https://crrev.com/b4a96a1fe749e668f5c4416be3fc58c1f9201fe7 > Cr-Commit-Position: refs/heads/master@{#341748} TBR=iclelland@chromium.org,johnme@chromium.org,mvanouwerkerk@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=511278 Review URL: https://codereview.chromium.org/1253013005 Cr-Commit-Position: refs/heads/master@{#341752}
* Move BackgroundSyncManager::ErrorType to BackgroundSyncStatusjkarlin2015-08-041-44/+60
| | | | | | | | | | This needs to be in its own file to prevent dependency loop issues. And it's more of a status than an error code so renaming. BUG=511278 Review URL: https://codereview.chromium.org/1246483002 Cr-Commit-Position: refs/heads/master@{#341748}
* [Background Sync] Restrict sync registration to service workers with window ↵iclelland2015-07-231-13/+20
| | | | | | | | | | clients. BUG=479658 Review URL: https://codereview.chromium.org/1234353004 Cr-Commit-Position: refs/heads/master@{#340141}
* [Background Sync] Sent sync registration details to workericlelland2015-07-221-2/+7
| | | | | | | | | | | | | | | | This sends the details of a fired sync event from the BackgroundSyncManager down to the running service worker. This is part 2 of a three-part blink-chromium-blink dance: Part 1: https://codereview.chromium.org/1220223003/ Part 2: [This one] Part 3: https://codereview.chromium.org/1231743004/ BUG=482066 Review URL: https://codereview.chromium.org/1230213004 Cr-Commit-Position: refs/heads/master@{#339882}
* [Background Sync] Record number of batched sync events in UMAiclelland2015-07-221-26/+35
| | | | | | | | BUG=490482 Review URL: https://codereview.chromium.org/1251523002 Cr-Commit-Position: refs/heads/master@{#339880}
* [Background Sync] Gather UMA data for Background Synciclelland2015-07-161-28/+117
| | | | | | | | | | | | | | | This patch adds UMA histograms for * Sync registrations and unregistrations * Sync event success and failure * Sync event total run time It adds logging to the BackgroundSyncManager to collect the data for these histograms. BUG=490482 Review URL: https://codereview.chromium.org/1227363002 Cr-Commit-Position: refs/heads/master@{#339072}
* Reregistering a background sync should reset its state from failed to pendingjkarlin2015-07-161-1/+11
| | | | | | | | | | A failed sync means it tried once and gave up. Reregistering that sync (without first unregistering it) should reset the state so that it can try again. This CL makes that change. BUG=507309 Review URL: https://codereview.chromium.org/1226303007 Cr-Commit-Position: refs/heads/master@{#339012}
* Make BackgroundSyncRegistration a proper classjkarlin2015-07-031-47/+42
| | | | | | | | | | This CL refactors content::BackgroundSyncManager::BackgroundSyncRegistration into content::BackgroundSyncRegistration. It also moves it from a struct into a class for better access control. In a followup CL the BackgroundSyncRegistration will become refcounted (so that the clients can own the registrations after the BackgroundSyncManager no longer cares about them). For more information see the bug. BUG=506271 Review URL: https://codereview.chromium.org/1221883004 Cr-Commit-Position: refs/heads/master@{#337306}
* Add a BackgroundSyncRegistrationOptions for BackgroundSyncManager::Registerjkarlin2015-07-021-31/+39
| | | | | | | | | | | | | BackgroundSyncManager::Register should take an options struct instead of a full blown Registration. At first, the registration and options were the same, but now the registration has grown and needs to be split off. BUG=506271 Review URL: https://codereview.chromium.org/1217223005 Cr-Commit-Position: refs/heads/master@{#337256}
* content: Remove use of MessageLoopProxy and deprecated MessageLoop APIsskyostil2015-06-051-33/+48
| | | | | | | | | | | | | | | This patch was mostly autogenerated with https://codereview.chromium.org/1010073002/. BUG=465354 TBR=nick@chromium.org Committed: https://crrev.com/422456f9d53f0bf936a64f21a1463fd0abd3df84 Cr-Commit-Position: refs/heads/master@{#333081} Review URL: https://codereview.chromium.org/1159623009 Cr-Commit-Position: refs/heads/master@{#333112}
* Revert "content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs"skyostil2015-06-051-48/+33
| | | | | | | | | | | | | This reverts commit 422456f9d53f0bf936a64f21a1463fd0abd3df84. TBR=zea@chromium.org BUG=465354 NOTRY=true NOTREECHECKS=true Review URL: https://codereview.chromium.org/1170623003 Cr-Commit-Position: refs/heads/master@{#333086}
* content: Remove use of MessageLoopProxy and deprecated MessageLoop APIsskyostil2015-06-051-33/+48
| | | | | | | | | | | | This patch was mostly autogenerated with https://codereview.chromium.org/1010073002/. BUG=465354 TBR=nick@chromium.org Review URL: https://codereview.chromium.org/1159623009 Cr-Commit-Position: refs/heads/master@{#333081}
* Revert "content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs"skyostil2015-06-051-48/+33
| | | | | | | | | | | | | | | This reverts commit 5d18b2493af36d77d3c491854e3d56f46f5f747c. Reason: Broke iOS build: http://build.chromium.org/p/chromium.mac/builders/iOS_Simulator_%28dbg%29/builds/27843 NOTRY=true NOTREECHECKS=true BUG=465354 TBR=sievers@chromium.org,nick@chromium.org Review URL: https://codereview.chromium.org/1153503009 Cr-Commit-Position: refs/heads/master@{#333047}
* content: Remove use of MessageLoopProxy and deprecated MessageLoop APIsskyostil2015-06-051-33/+48
| | | | | | | | | | | | This patch was mostly autogenerated with https://codereview.chromium.org/1010073002/. BUG=465354 TBR=nick@chromium.org Review URL: https://codereview.chromium.org/1159623009 Cr-Commit-Position: refs/heads/master@{#333043}
* [BackgroundSync] Reland of Launch Chrome on Android for One-Shotjkarlin2015-05-291-0/+37
| | | | | | | | | | | | | | This is a reland of https://codereview.chromium.org/1140813006/ There was an unused variable on non-android builds (chromeos daisy bot tripped on it). See http://build.chromium.org/p/chromium.chromiumos/builders/ChromiumOS%20daisy%20Compile/builds/83/steps/compile/logs/stdio Fixed by making the whole function Android only until other platforms land. BUG=479665 Review URL: https://codereview.chromium.org/1163583004 Cr-Commit-Position: refs/heads/master@{#331946}
* [BackgroundSync] Reland of PowerObserverjkarlin2015-05-291-1/+11
| | | | | | | | | | | | | | This is a reland of https://codereview.chromium.org/1126563002/ There is a funky test that creates and deletes a PowerMonitor before deleting a profile. This trips a BackgroundSyncPowerObserver destructor DCHECK to verify that the PowerMonitor still exists. This CL changes the DCHECK to verify that the PowerMonitor still exists only when the BackgroundSyncPowerObserver is being used. BUG=482053 Review URL: https://codereview.chromium.org/1162643002 Cr-Commit-Position: refs/heads/master@{#331943}
* Revert of [BackgroundSync] Launch the browser on Android when next online ↵spang2015-05-281-38/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (patchset #17 id:340001 of https://codereview.chromium.org/1140813006/) Reason for revert: Unused variable breaks CrOS build: http://build.chromium.org/p/chromium.chromiumos/builders/ChromiumOS%20daisy%20Compile/builds/83/steps/compile/logs/stdio ../../content/browser/background_sync/background_sync_manager.cc: In member function 'void content::BackgroundSyncManager::SchedulePendingRegistrations()': ../../content/browser/background_sync/background_sync_manager.cc:650:8: error: variable 'keep_browser_alive_for_one_shot' set but not used [-Werror=unused-but-set-variable] bool keep_browser_alive_for_one_shot = false; ^ cc1plus.elf: all warnings being treated as errors Original issue's description: > [BackgroundSync] Launch the browser on Android when next online > > On Android devices BackgroundSync needs to launch the browser the next time the device goes online if a one-shot sync is registered. This CL adds an Android Receiver and Service (BackgroundSyncLauncherService) to listen to connectvity events and launch the browser. It also provides a BackgroundSyncLauncher JNI class that C++ can interact with to register interest in launching in the background. > > This feature is experimental and behind a flag. > > Note that the components_tests.gyp change (to add content_java) is because content::StoragePartition creates a BackgroundSyncManager which immediately talks to java therefore the content java classes are needed for testing. > > BUG=479665 > > Committed: https://crrev.com/6970b0ad59723ced9cc473f5474e8c3c0bf5d7bc > Cr-Commit-Position: refs/heads/master@{#331826} TBR=jochen@chromium.org,jdduke@chromium.org,mvanouwerkerk@chromium.org,nyquist@chromium.org,peter@chromium.org,tedchoc@chromium.org,jkarlin@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=479665 Review URL: https://codereview.chromium.org/1149373007 Cr-Commit-Position: refs/heads/master@{#331836}
* [BackgroundSync] Launch the browser on Android when next onlinejkarlin2015-05-281-0/+38
| | | | | | | | | | | | | | On Android devices BackgroundSync needs to launch the browser the next time the device goes online if a one-shot sync is registered. This CL adds an Android Receiver and Service (BackgroundSyncLauncherService) to listen to connectvity events and launch the browser. It also provides a BackgroundSyncLauncher JNI class that C++ can interact with to register interest in launching in the background. This feature is experimental and behind a flag. Note that the components_tests.gyp change (to add content_java) is because content::StoragePartition creates a BackgroundSyncManager which immediately talks to java therefore the content java classes are needed for testing. BUG=479665 Review URL: https://codereview.chromium.org/1140813006 Cr-Commit-Position: refs/heads/master@{#331826}
* Revert of [BackgroundSync] Implement power monitoring for powerState ↵caitkp2015-05-281-11/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | condition on sync registrations (patchset #11 id:220001 of https://codereview.chromium.org/1126563002/) Reason for revert: This has been caused frequent failures on the Mac 10.9 (DBG) unit tests: http://build.chromium.org/p/chromium.mac/builders/Mac10.9%20Tests%20%28dbg%29/builds/6414 Stack trace: [7141:1287:0528/070746:1947088689861:FATAL:background_sync_power_observer.cc(27)] Check failed: observing_power_monitor_ == power_monitor != nullptr (1 vs. 0) 0 libbase.dylib 0x000000012325ff5f base::debug::StackTrace::StackTrace() + 47 1 libbase.dylib 0x000000012325ffb3 base::debug::StackTrace::StackTrace() + 35 2 libbase.dylib 0x00000001232c2663 logging::LogMessage::~LogMessage() + 67 3 libbase.dylib 0x00000001232c16f3 logging::LogMessage::~LogMessage() + 35 4 libcontent.dylib 0x000000012749ae78 content::BackgroundSyncPowerObserver::~BackgroundSyncPowerObserver() + 216 5 libcontent.dylib 0x000000012749af03 content::BackgroundSyncPowerObserver::~BackgroundSyncPowerObserver() + 35 6 libcontent.dylib 0x000000012749af5a content::BackgroundSyncPowerObserver::~BackgroundSyncPowerObserver() + 42 7 libcontent.dylib 0x00000001274821ed base::DefaultDeleter\u003Ccontent::BackgroundSyncPowerObserver>::operator()(content::BackgroundSyncPowerObserver*) const + 61 8 libcontent.dylib 0x000000012748218f base::internal::scoped_ptr_impl\u003Ccontent::BackgroundSyncPowerObserver, base::DefaultDeleter\u003Ccontent::BackgroundSyncPowerObserver> >::~scoped_ptr_impl() + 63 9 libcontent.dylib 0x0000000127482123 base::internal::scoped_ptr_impl\u003Ccontent::BackgroundSyncPowerObserver, base::DefaultDeleter\u003Ccontent::BackgroundSyncPowerObserver> >::~scoped_ptr_impl() + 35 10 libcontent.dylib 0x00000001274820d3 scoped_ptr\u003Ccontent::BackgroundSyncPowerObserver, base::DefaultDeleter\u003Ccontent::BackgroundSyncPowerObserver> >::~scoped_ptr() + 35 11 libcontent.dylib 0x000000012747d163 scoped_ptr\u003Ccontent::BackgroundSyncPowerObserver, base::DefaultDeleter\u003Ccontent::BackgroundSyncPowerObserver> >::~scoped_ptr() + 35 12 libcontent.dylib 0x0000000127474a35 content::BackgroundSyncManager::~BackgroundSyncManager() + 421 13 libcontent.dylib 0x0000000127474ae3 content::BackgroundSyncManager::~BackgroundSyncManager() + 35 14 libcontent.dylib 0x0000000127474b3a content::BackgroundSyncManager::~BackgroundSyncManager() + 42 15 libcontent.dylib 0x000000012747256d base::DefaultDeleter\u003Ccontent::BackgroundSyncManager>::operator()(content::BackgroundSyncManager*) const + 61 16 libcontent.dylib 0x000000012747405a base::internal::scoped_ptr_impl\u003Ccontent::BackgroundSyncManager, base::DefaultDeleter\u003Ccontent::BackgroundSyncManager> >::reset(content::BackgroundSyncManager*) + 170 17 libcontent.dylib 0x000000012747240b scoped_ptr\u003Ccontent::BackgroundSyncManager, base::DefaultDeleter\u003Ccontent::BackgroundSyncManager> >::reset(content::BackgroundSyncManager*) + 43 18 libcontent.dylib 0x0000000127471e78 content::BackgroundSyncContextImpl::ShutdownOnIO() + 344 19 libcontent.dylib 0x0000000127473eb7 base::internal::RunnableAdapter\u003Cvoid (content::BackgroundSyncContextImpl::*)()>::Run(content::BackgroundSyncContextImpl*) + 119 20 libcontent.dylib 0x0000000127473e17 base::internal::InvokeHelper\u003Cfalse, void, base::internal::RunnableAdapter\u003Cvoid (content::BackgroundSyncContextImpl::*)()>, base::internal::TypeList\u003Ccontent::BackgroundSyncContextImpl* const&> >::MakeItSo(base::internal::RunnableAdapter\u003Cvoid (content::BackgroundSyncContextImpl::*)()>, content::BackgroundSyncContextImpl* const&) + 55 21 libcontent.dylib 0x0000000127473dbe base::internal::Invoker\u003CIndexSequence\u003C0ul>, base::internal::BindState\u003Cbase::internal::RunnableAdapter\u003Cvoid (content::BackgroundSyncContextImpl::*)()>, void (content::BackgroundSyncContextImpl*), base::internal::TypeList\u003Ccontent::BackgroundSyncContextImpl*> >, base::internal::TypeList\u003Cbase::internal::UnwrapTraits\u003Ccontent::BackgroundSyncContextImpl*> >, base::internal::InvokeHelper\u003Cfalse, void, base::internal::RunnableAdapter\u003Cvoid (content::BackgroundSyncContextImpl::*)()>, base::internal::TypeList\u003Ccontent::BackgroundSyncContextImpl* const&> >, void ()>::Run(base::internal::BindStateBase*) + 94 22 libbase.dylib 0x0000000123247a6f base::Callback\u003Cvoid ()>::Run() const + 63 23 libbase.dylib 0x00000001232620f1 base::debug::TaskAnnotator::RunTask(char const*, char const*, base::PendingTask const&) + 913 24 libbase.dylib 0x00000001232fa9c2 base::MessageLoop::RunTask(base::PendingTask const&) + 450 25 libbase.dylib 0x00000001232fab46 base::MessageLoop::DeferOrRunPendingTask(base::PendingTask const&) + 86 26 libbase.dylib 0x00000001232fad8d base::MessageLoop::DoWork() + 301 27 libbase.dylib 0x00000001232264eb base::MessagePumpLibevent::Run(base::MessagePump::Delegate*) + 139 28 libbase.dylib 0x00000001232fa533 base::MessageLoop::RunHandler() + 243 29 libbase.dylib 0x000000012336e2c5 base::RunLoop::Run() + 85 30 libbase.dylib 0x000000012336e56a base::RunLoop::RunUntilIdle() + 42 31 unit_tests 0x000000010e6eabe3 content::TestBrowserThreadBundle::~TestBrowserThreadBundle() + 67 32 unit_tests 0x000000010e6eaea3 content::TestBrowserThreadBundle::~TestBrowserThreadBundle() + 35 33 unit_tests 0x000000010b4c7f79 base::DefaultDeleter\u003Ccontent::TestBrowserThreadBundle>::operator()(content::TestBrowserThreadBundle*) const + 57 34 unit_tests 0x000000010b4c7f1f base::internal::scoped_ptr_impl\u003Ccontent::TestBrowserThreadBundle, base::DefaultDeleter\u003Ccontent::TestBrowserThreadBundle> >::~scoped_ptr_impl() + 63 35 unit_tests 0x000000010b4c7eb3 base::internal::scoped_ptr_impl\u003Ccontent::TestBrowserThreadBundle, base::DefaultDeleter\u003Ccontent::TestBrowserThreadBundle> >::~scoped_ptr_impl() + 35 36 unit_tests 0x000000010b4c7e63 scoped_ptr\u003Ccontent::TestBrowserThreadBundle, base::DefaultDeleter\u003Ccontent::TestBrowserThreadBundle> >::~scoped_ptr() + 35 37 unit_tests 0x000000010b4c7b03 scoped_ptr\u003Ccontent::TestBrowserThreadBundle, base::DefaultDeleter\u003Ccontent::TestBrowserThreadBundle> >::~scoped_ptr() + 35 38 unit_tests 0x000000010bf55887 extensions::ExtensionServiceTestBase::~ExtensionServiceTestBase() + 231 39 unit_tests 0x000000010bfe1017 ExtensionServiceTest::~ExtensionServiceTest() + 199 40 unit_tests 0x000000010c013076 ExtensionServiceTest_ExternalInstallMultiple_Test::~ExtensionServiceTest_ExternalInstallMultiple_Test() + 38 41 unit_tests 0x000000010bfdfd33 ExtensionServiceTest_ExternalInstallMultiple_Test::~ExtensionServiceTest_ExternalInstallMultiple_Test() + 35 42 unit_tests 0x000000010bfdfd8a ExtensionServiceTest_ExternalInstallMultiple_Test::~ExtensionServiceTest_ExternalInstallMultiple_Test() + 42 43 unit_tests 0x000000010e81eb79 testing::Test::DeleteSelf_() + 57 44 unit_tests 0x000000010e82ec88 void testing::internal::HandleSehExceptionsInMethodIfSupported\u003Ctesting::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) + 136 45 unit_tests 0x000000010e81e63c void testing::internal::HandleExceptionsInMethodIfSupported\u003Ctesting::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) + 124 46 unit_tests 0x000000010e8123fe testing::TestInfo::Run() + 302 47 unit_tests 0x000000010e812ba5 testing::TestCase::Run() + 245 48 unit_tests 0x000000010e818b4d testing::internal::UnitTestImpl::RunAllTests() + 733 49 unit_tests 0x000000010e832968 bool testing::internal::HandleSehExceptionsInMethodIfSupported\u003Ctesting::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) + 136 50 unit_tests 0x000000010e820bbf bool testing::internal::HandleExceptionsInMethodIfSupported\u003Ctesting::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) + 127 51 unit_tests 0x000000010e81882d testing::UnitTest::Run() + 205 52 unit_tests 0x000000010e646e03 RUN_ALL_TESTS() + 35 53 unit_tests 0x000000010e645909 base::TestSuite::Run() + 169 54 unit_tests 0x000000010e7036eb content::UnitTestTestSuite::Run() + 43 55 unit_tests 0x000000010e917877 base::internal::RunnableAdapter\u003Cint (content::UnitTestTestSuite::*)()>::Run(content::UnitTestTestSuite*) + 119 56 unit_tests 0x000000010e91773a base::internal::InvokeHelper\u003Cfalse, int, base::internal::RunnableAdapter\u003Cint (content::UnitTestTestSuite::*)()>, base::internal::TypeList\u003Ccontent::UnitTestTestSuite*> >::MakeItSo(base::internal::RunnableAdapter\u003Cint (content::UnitTestTestSuite::*)()>, content::UnitTestTestSuite*) + 58 57 unit_tests 0x000000010e9176d6 base::internal::Invoker\u003CIndexSequence\u003C0ul>, base::internal::BindState\u003Cbase::internal::RunnableAdapter\u003Cint (content::UnitTestTestSuite::*)()>, int (content::UnitTestTestSuite*), base::internal::TypeList\u003Cbase::internal::UnretainedWrapper\u003Ccontent::UnitTestTestSuite> > >, base::internal::TypeList\u003Cbase::internal::UnwrapTraits\u003Cbase::internal::UnretainedWrapper\u003Ccontent::UnitTestTestSuite> > >, base::internal::InvokeHelper\u003Cfalse, int, base::internal::RunnableAdapter\u003Cint (content::UnitTestTestSuite::*)()>, base::internal::TypeList\u003Ccontent::UnitTestTestSuite*> >, int ()>::Run(base::internal::BindStateBase*) + 102 58 unit_tests 0x000000010e63687f base::Callback\u003Cint ()>::Run() const + 63 59 unit_tests 0x000000010e632475 base::(anonymous namespace)::LaunchUnitTestsInternal(base::Callback\u003Cint ()> const&, int, bool, base::Callback\u003Cvoid ()> const&) + 341 60 unit_tests 0x000000010e6322e5 base::LaunchUnitTests(int, char**, base::Callback\u003Cint ()> const&) + 117 61 unit_tests 0x000000010e916df3 main + 195 Original issue's description: > [BackgroundSync] Implement power monitoring for powerState condition on sync registrations > > Implement the "powerState" condition of background sync registrations. See > https://github.com/slightlyoff/BackgroundSync/blob/4f0a14df6a9288b758bf334d430f523038830d1e/explainer.md for more detail. > > BUG=482053 > > Committed: https://crrev.com/aea9725f7f32ac700179fc81f1d904bf4e4f6d69 > Cr-Commit-Position: refs/heads/master@{#331680} TBR=iclelland@chromium.org,johnme@chromium.org,jkarlin@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=482053 Review URL: https://codereview.chromium.org/1146283012 Cr-Commit-Position: refs/heads/master@{#331778}
* [BackgroundSync] Implement power monitoring for powerState condition on sync ↵jkarlin2015-05-271-1/+11
| | | | | | | | | | | | | registrations Implement the "powerState" condition of background sync registrations. See https://github.com/slightlyoff/BackgroundSync/blob/4f0a14df6a9288b758bf334d430f523038830d1e/explainer.md for more detail. BUG=482053 Review URL: https://codereview.chromium.org/1126563002 Cr-Commit-Position: refs/heads/master@{#331680}
* [BackgroundSyncManager] Clean up some extra functions with variadic templatesjkarlin2015-05-071-53/+22
| | | | | | | | | | | | This CL removes some redundant functions via variadic templates. Note that it also removes an unnecessary weak ptr check since the BackgroundSyncManager will not be deleted by the callback as suggested by the comment (it's owned by the StoragePartition). Downstream of https://crrev.com/1119783003 BUG= Review URL: https://codereview.chromium.org/1116293003 Cr-Commit-Position: refs/heads/master@{#328773}
* [BackgroundSync] Add BackgroundSyncManager::GetRegistrations() and testsjkarlin2015-05-071-1/+70
| | | | | | | | | | GetRegistrations() returns the list of registrations for a given service worker of a given periodicity. BUG=483578 Review URL: https://codereview.chromium.org/1119783003 Cr-Commit-Position: refs/heads/master@{#328761}
* [BackgroundSync] Fire one-shot eventsjkarlin2015-05-011-5/+241
| | | | | | | | | | | | | | | | Fires one-shot events. * Checks for ready events to fire on network change * Checks for ready events to fire on registration * A successful event will unregister itself after firing * A failed event will not fire again until a controlled page load (that is for a future CL) * Lots and lots of tests! BUG=479665 Review URL: https://codereview.chromium.org/1106523002 Cr-Commit-Position: refs/heads/master@{#327911}
* [BackgroundSyncManager] Remove origin argument from public ↵jkarlin2015-04-281-11/+16
| | | | | | | | | | | | | | | | BackgroundSyncManager methods The origin can be determined from the live ServiceWorkerRegistration, use that instead of requiring the renderer to pass it. Also, verify that the live registration is active to prevent BackgroundSyncManager::Register from being called prematurely. BUG=482012 Review URL: https://codereview.chromium.org/1110993003 Cr-Commit-Position: refs/heads/master@{#327371}
* ServiceWorker: Stop exposing ServiceWorkerContextCorenhiroki2015-04-231-4/+4
| | | | | | | | | | | | | | | | | | | | External components (eg. Push) can directly access SWContextCore, but the context core is designed for internal use and should be accessed via SWContextWrapper because it can be null in some cases (eg, failing to restart the system. See [1,2] for details of the wrapper-core layering). To enforce the rule, this CL stops exposing the context core and makes the wrapper to provide interfaces for that instead. [1] https://code.google.com/p/chromium/issues/detail?id=371675#c18 [2] https://docs.google.com/document/d/1eXdgnAOZC4dDDybmRpXT0t0lOYGhFf7xajOSanEb91Y/edit?usp=sharing BUG=472019 TEST=compile Review URL: https://codereview.chromium.org/1079923002 Cr-Commit-Position: refs/heads/master@{#326464}
* [BackgroundSync] Store origin with registration datajkarlin2015-04-221-12/+14
| | | | | | | | | | | | The origin GURL needs to be stored along with the registration for looking up service worker registrations (to start the necessary service worker and fire its events). BUG=479665 Review URL: https://codereview.chromium.org/1084043003 Cr-Commit-Position: refs/heads/master@{#326339}
* [BackgroundSync] Make BackgroundSyncManager::LookupRegistration return a ↵jkarlin2015-04-211-29/+24
| | | | | | | | pointer instead of a copy Review URL: https://codereview.chromium.org/1097323002 Cr-Commit-Position: refs/heads/master@{#326144}
* [BackgroundSync] Hang the BackgroundSyncManager off of the StoragePartitionjkarlin2015-04-201-0/+4
| | | | | | | | | | | Create the BackgroundSyncManager with each StoragePartition. It requires a context class to wrap the BackgroundSyncManager and create/delete it on the IO thread. BUG=477725 Review URL: https://codereview.chromium.org/1097503004 Cr-Commit-Position: refs/heads/master@{#325893}
* [BackgroundSyncManager] Add a network connection observerjkarlin2015-04-171-0/+12
| | | | | | | | | | | | | Adds a BackgroundSyncNetworkObserver class to notify BackgroundSyncManager when the network connection has changed and to test whether a registration has met the necessary network conditions to run. BUG=477366 Review URL: https://codereview.chromium.org/1090913002 Cr-Commit-Position: refs/heads/master@{#325703}
* [BackgroundSyncManager] Tags with different periodicities can overlapjkarlin2015-04-101-31/+49
| | | | | | | | | | | | | The background sync spec (see https://github.com/slightlyoff/BackgroundSync/pull/74) allows for registrations to coexist with the same tag so long as they have different periodicities (one-shot vs periodic). This CL changes Registration::fire_once to Registration::periodicity and indexes registrations by RegistrationKey instead of by tag. RegistrationKey incorporates both the tag and the periodicity. BUG=474573 Review URL: https://codereview.chromium.org/1065313002 Cr-Commit-Position: refs/heads/master@{#324691}
* [BackgroundSyncManager] Rename BackgroundSyncRegistration.name to tagjkarlin2015-04-081-26/+25
| | | | | | | | | | This refactoring of 'name' to 'tag' is part of tracking the latest spec changes found in https://github.com/slightlyoff/BackgroundSync/pull/74 BUG=474573 Review URL: https://codereview.chromium.org/1068863003 Cr-Commit-Position: refs/heads/master@{#324233}
* Remove unused parameter.jkarlin2015-04-071-14/+4
| | | | | | Review URL: https://codereview.chromium.org/1059183004 Cr-Commit-Position: refs/heads/master@{#324141}
* [BackgroundSync] Add new registration options from the specjkarlin2015-04-071-9/+13
| | | | | | | | | | | | | | This CL brings the BackgroundSyncRegistration options up-to-date with the spec: https://github.com/slightlyoff/BackgroundSync/pull/74 TODO in followup CLs: * Rename 'name' to 'tag': http://crrev.com/1068863003. * Give periodic and one-shot tags their own namespaces in the map so that they don't conflict. BUG=474573 Review URL: https://codereview.chromium.org/1068863002 Cr-Commit-Position: refs/heads/master@{#324077}
* [BackgroundSync] Handle storage failurejkarlin2015-04-031-36/+200
| | | | | | | | | | | | | | | | | | This CL introduces proper failure handling in case the storage backend fails. Changes: 1. If the ServiceWorker is unregistered - Remove the sync registrations from memory 2. If the ServiceWorkerStorage is wiped - Reinit the BackgroundSyncManager 3. If reading or writing from ServiceWorkerStorage fails (SERVICE_WORKER_ERROR_FAILURE) - Delete everything and disable the BackgroundSyncManager until browser restart. Added unittests for above cases. I had to change the unittest to register serviceworkers via the ServiceWorkerContext instead of directly in Storage so that the ServiceWorkerContextObserver receives updates. BUG=449443 Review URL: https://codereview.chromium.org/1048053002 Cr-Commit-Position: refs/heads/master@{#323756}
* [BackgroundSync] Initial land of the BackgroundSyncManagerjkarlin2015-03-261-0/+414
The BackgroundSyncManager is the class that handles registration of background syncs. This first CL handles storage and retrieval of registrations and sequential ordering of async operations. Future CLs will add permission checks and incorporate a scheduler. Eventually the BackgroundSyncManager will be created and owned by the BackgroundSyncMessageFilter, which will be owned by the RenderViewHost. BackgroundSync Design Doc: https://docs.google.com/document/d/1MAuNzV0q5FporLZVJMh7CMrwTHwcZsWX6YUwPwKMGco/ BUG=449443 Review URL: https://codereview.chromium.org/950343006 Cr-Commit-Position: refs/heads/master@{#322375}