Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: chrome/browser/notifications/sync_notifier/synced_notification_app_info_service.cc

Issue 202993002: Fix "unreachable code" warnings (MSVC warning 4702) in chrome/browser/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 // The SyncedNotificationAppInfoService brings down read only metadata from the 5 // The SyncedNotificationAppInfoService brings down read only metadata from the
6 // sync server with information about the services sending synced notifications. 6 // sync server with information about the services sending synced notifications.
7 7
8 #include "chrome/browser/notifications/sync_notifier/synced_notification_app_inf o_service.h" 8 #include "chrome/browser/notifications/sync_notifier/synced_notification_app_inf o_service.h"
9 9
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 24 matching lines...) Expand all
35 SyncedNotificationAppInfoService::MergeDataAndStartSyncing( 35 SyncedNotificationAppInfoService::MergeDataAndStartSyncing(
36 syncer::ModelType type, 36 syncer::ModelType type,
37 const syncer::SyncDataList& initial_sync_data, 37 const syncer::SyncDataList& initial_sync_data,
38 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, 38 scoped_ptr<syncer::SyncChangeProcessor> sync_processor,
39 scoped_ptr<syncer::SyncErrorFactory> error_handler) { 39 scoped_ptr<syncer::SyncErrorFactory> error_handler) {
40 thread_checker_.CalledOnValidThread(); 40 thread_checker_.CalledOnValidThread();
41 DCHECK_EQ(syncer::SYNCED_NOTIFICATION_APP_INFO, type); 41 DCHECK_EQ(syncer::SYNCED_NOTIFICATION_APP_INFO, type);
42 syncer::SyncMergeResult merge_result(syncer::SYNCED_NOTIFICATION_APP_INFO); 42 syncer::SyncMergeResult merge_result(syncer::SYNCED_NOTIFICATION_APP_INFO);
43 43
44 // There should only be one sync data in the list for this data type. 44 // There should only be one sync data in the list for this data type.
45 if (initial_sync_data.size() != 1 && initial_sync_data.size() != 0) { 45 if (initial_sync_data.size() > 1) {
46 LOG(ERROR) << "Too many app infos over sync"; 46 LOG(ERROR) << "Too many app infos over sync";
47 } 47 }
48 48
49 for (syncer::SyncDataList::const_iterator it = initial_sync_data.begin(); 49 // TODO(petewil): Today we can only handle a single object, so we simply check
50 it != initial_sync_data.end(); 50 // for a non-empty list. If in the future we can ever handle more, convert
51 ++it) { 51 // this whole block to be a loop over all of |initial_sync_data|.
52 const syncer::SyncData& sync_data = *it; 52 if (!initial_sync_data.empty()) {
53 const syncer::SyncData& sync_data = initial_sync_data.front();
53 DCHECK_EQ(syncer::SYNCED_NOTIFICATION_APP_INFO, sync_data.GetDataType()); 54 DCHECK_EQ(syncer::SYNCED_NOTIFICATION_APP_INFO, sync_data.GetDataType());
54 55
55 const sync_pb::SyncedNotificationAppInfoSpecifics& specifics = 56 const sync_pb::SyncedNotificationAppInfoSpecifics& specifics =
56 sync_data.GetSpecifics().synced_notification_app_info(); 57 sync_data.GetSpecifics().synced_notification_app_info();
57 58
58 // Store our sync data, so GetAllSyncData can give it back later. 59 // Store our sync data, so GetAllSyncData can give it back later.
59 sync_data_ = sync_data; 60 sync_data_ = sync_data;
60 61
61 size_t app_info_count = specifics.synced_notification_app_info_size(); 62 size_t app_info_count = specifics.synced_notification_app_info_size();
62 63
63 // The SyncedNotificationAppInfo is a repeated field, process each one. 64 // The SyncedNotificationAppInfo is a repeated field, process each one.
64 for (size_t app_info_index = 0; 65 for (size_t app_info_index = 0;
65 app_info_index < app_info_count; 66 app_info_index < app_info_count;
66 ++app_info_index) { 67 ++app_info_index) {
67 const sync_pb::SyncedNotificationAppInfo app_info( 68 const sync_pb::SyncedNotificationAppInfo app_info(
68 specifics.synced_notification_app_info(app_info_index)); 69 specifics.synced_notification_app_info(app_info_index));
69 70
70 ProcessIncomingAppInfoProtobuf(app_info); 71 ProcessIncomingAppInfoProtobuf(app_info);
71 } 72 }
72
73 // TODO(petewil): Today we can only handle a single object, so we break
74 // here. In the future if we can ever handle more, remove the next line.
75 break;
76 } 73 }
77 74
78 return merge_result; 75 return merge_result;
79 } 76 }
80 77
81 void SyncedNotificationAppInfoService::StopSyncing(syncer::ModelType type) { 78 void SyncedNotificationAppInfoService::StopSyncing(syncer::ModelType type) {
82 DCHECK_EQ(syncer::SYNCED_NOTIFICATION_APP_INFO, type); 79 DCHECK_EQ(syncer::SYNCED_NOTIFICATION_APP_INFO, type);
83 // Implementation is not required, since this is not a user selectable sync 80 // Implementation is not required, since this is not a user selectable sync
84 // type. 81 // type.
85 } 82 }
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 } 233 }
237 234
238 // Add a new app info to our data structure. This takes ownership 235 // Add a new app info to our data structure. This takes ownership
239 // of the passed in pointer. 236 // of the passed in pointer.
240 void SyncedNotificationAppInfoService::Add( 237 void SyncedNotificationAppInfoService::Add(
241 scoped_ptr<SyncedNotificationAppInfo> app_info) { 238 scoped_ptr<SyncedNotificationAppInfo> app_info) {
242 sending_service_infos_.push_back(app_info.release()); 239 sending_service_infos_.push_back(app_info.release());
243 } 240 }
244 241
245 } // namespace notifier 242 } // namespace notifier
OLDNEW
« no previous file with comments | « chrome/browser/media/chrome_webrtc_apprtc_browsertest.cc ('k') | chrome/browser/prefs/incognito_mode_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698