OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/background_sync/background_sync_service_impl.h" | 5 #include "content/browser/background_sync/background_sync_service_impl.h" |
6 | 6 |
7 #include "background_sync_registration_handle.h" | 7 #include "background_sync_registration_handle.h" |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "content/browser/background_sync/background_sync_context_impl.h" | 10 #include "content/browser/background_sync/background_sync_context_impl.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 out->power_state = | 40 out->power_state = |
41 static_cast<content::BackgroundSyncPowerState>(in.options()->power_state); | 41 static_cast<content::BackgroundSyncPowerState>(in.options()->power_state); |
42 out->network_state = static_cast<content::BackgroundSyncNetworkState>( | 42 out->network_state = static_cast<content::BackgroundSyncNetworkState>( |
43 in.options()->network_state); | 43 in.options()->network_state); |
44 return out.Pass(); | 44 return out.Pass(); |
45 } | 45 } |
46 | 46 |
47 } // namespace | 47 } // namespace |
48 | 48 |
49 #define COMPILE_ASSERT_MATCHING_ENUM(mojo_name, manager_name) \ | 49 #define COMPILE_ASSERT_MATCHING_ENUM(mojo_name, manager_name) \ |
50 COMPILE_ASSERT(static_cast<int>(content::mojo_name) == \ | 50 static_assert(static_cast<int>(content::mojo_name) == \ |
51 static_cast<int>(content::manager_name), \ | 51 static_cast<int>(content::manager_name), \ |
52 mismatching_enums) | 52 "mojo and manager enums must match") |
53 | 53 |
54 // TODO(iclelland): Move these tests somewhere else | 54 // TODO(iclelland): Move these tests somewhere else |
55 COMPILE_ASSERT_MATCHING_ENUM(BACKGROUND_SYNC_ERROR_NONE, | 55 COMPILE_ASSERT_MATCHING_ENUM(BACKGROUND_SYNC_ERROR_NONE, |
56 BACKGROUND_SYNC_STATUS_OK); | 56 BACKGROUND_SYNC_STATUS_OK); |
57 COMPILE_ASSERT_MATCHING_ENUM(BACKGROUND_SYNC_ERROR_STORAGE, | 57 COMPILE_ASSERT_MATCHING_ENUM(BACKGROUND_SYNC_ERROR_STORAGE, |
58 BACKGROUND_SYNC_STATUS_STORAGE_ERROR); | 58 BACKGROUND_SYNC_STATUS_STORAGE_ERROR); |
59 COMPILE_ASSERT_MATCHING_ENUM(BACKGROUND_SYNC_ERROR_NOT_FOUND, | 59 COMPILE_ASSERT_MATCHING_ENUM(BACKGROUND_SYNC_ERROR_NOT_FOUND, |
60 BACKGROUND_SYNC_STATUS_NOT_FOUND); | 60 BACKGROUND_SYNC_STATUS_NOT_FOUND); |
61 COMPILE_ASSERT_MATCHING_ENUM(BACKGROUND_SYNC_ERROR_NO_SERVICE_WORKER, | 61 COMPILE_ASSERT_MATCHING_ENUM(BACKGROUND_SYNC_ERROR_NO_SERVICE_WORKER, |
62 BACKGROUND_SYNC_STATUS_NO_SERVICE_WORKER); | 62 BACKGROUND_SYNC_STATUS_NO_SERVICE_WORKER); |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 | 289 |
290 void BackgroundSyncServiceImpl::OnNotifyWhenFinishedResult( | 290 void BackgroundSyncServiceImpl::OnNotifyWhenFinishedResult( |
291 const NotifyWhenFinishedCallback& callback, | 291 const NotifyWhenFinishedCallback& callback, |
292 BackgroundSyncStatus status, | 292 BackgroundSyncStatus status, |
293 BackgroundSyncState sync_state) { | 293 BackgroundSyncState sync_state) { |
294 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 294 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
295 callback.Run(static_cast<content::BackgroundSyncError>(status), sync_state); | 295 callback.Run(static_cast<content::BackgroundSyncError>(status), sync_state); |
296 } | 296 } |
297 | 297 |
298 } // namespace content | 298 } // namespace content |
OLD | NEW |