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

Side by Side Diff: chrome/browser/sync/engine/syncapi.cc

Issue 211019: Fix compiling of sync on linux. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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 (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 "chrome/browser/sync/engine/syncapi.h" 5 #include "chrome/browser/sync/engine/syncapi.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <windows.h> 10 #include <windows.h>
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 HANDLE exit_flag; 83 HANDLE exit_flag;
84 #endif 84 #endif
85 }; 85 };
86 86
87 // This thread calls CheckServerReachable() whenever a change occurs in the 87 // This thread calls CheckServerReachable() whenever a change occurs in the
88 // table that maps IP addresses to interfaces, for example when the user 88 // table that maps IP addresses to interfaces, for example when the user
89 // unplugs his network cable. 89 // unplugs his network cable.
90 void* AddressWatchThread(void* arg) { 90 void* AddressWatchThread(void* arg) {
91 NameCurrentThreadForDebugging("SyncEngine_AddressWatcher"); 91 NameCurrentThreadForDebugging("SyncEngine_AddressWatcher");
92 LOG(INFO) << "starting the address watch thread"; 92 LOG(INFO) << "starting the address watch thread";
93 #if defined(OS_WIN)
93 const ThreadParams* const params = reinterpret_cast<const ThreadParams*>(arg); 94 const ThreadParams* const params = reinterpret_cast<const ThreadParams*>(arg);
94 #if defined(OS_WIN)
95 OVERLAPPED overlapped = {0}; 95 OVERLAPPED overlapped = {0};
96 overlapped.hEvent = CreateEvent(NULL, FALSE, TRUE, NULL); 96 overlapped.hEvent = CreateEvent(NULL, FALSE, TRUE, NULL);
97 HANDLE file; 97 HANDLE file;
98 DWORD rc = WAIT_OBJECT_0; 98 DWORD rc = WAIT_OBJECT_0;
99 while (true) { 99 while (true) {
100 // Only call NotifyAddrChange() after the IP address has changed or if this 100 // Only call NotifyAddrChange() after the IP address has changed or if this
101 // is the first time through the loop. 101 // is the first time through the loop.
102 if (WAIT_OBJECT_0 == rc) { 102 if (WAIT_OBJECT_0 == rc) {
103 ResetEvent(overlapped.hEvent); 103 ResetEvent(overlapped.hEvent);
104 DWORD notify_result = NotifyAddrChange(&file, &overlapped); 104 DWORD notify_result = NotifyAddrChange(&file, &overlapped);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 return kInvalidId; 149 return kInvalidId;
150 return entry.Get(syncable::META_HANDLE); 150 return entry.Get(syncable::META_HANDLE);
151 } 151 }
152 152
153 // Checks whether |name| is a server-illegal name followed by zero or more space 153 // Checks whether |name| is a server-illegal name followed by zero or more space
154 // characters. The three server-illegal names are the empty string, dot, and 154 // characters. The three server-illegal names are the empty string, dot, and
155 // dot-dot. Very long names (>255 bytes in UTF-8 Normalization Form C) are 155 // dot-dot. Very long names (>255 bytes in UTF-8 Normalization Form C) are
156 // also illegal, but are not considered here. 156 // also illegal, but are not considered here.
157 static bool IsNameServerIllegalAfterTrimming(const string16& name) { 157 static bool IsNameServerIllegalAfterTrimming(const string16& name) {
158 size_t untrimmed_count = name.find_last_not_of(' ') + 1; 158 size_t untrimmed_count = name.find_last_not_of(' ') + 1;
159 for (int i = 0; i < arraysize(kForbiddenServerNames); ++i) { 159 for (size_t i = 0; i < arraysize(kForbiddenServerNames); ++i) {
160 if (name.compare(0, untrimmed_count, kForbiddenServerNames[i]) == 0) 160 if (name.compare(0, untrimmed_count, kForbiddenServerNames[i]) == 0)
161 return true; 161 return true;
162 } 162 }
163 return false; 163 return false;
164 } 164 }
165 165
166 static bool EndsWithSpace(const string16& string) { 166 static bool EndsWithSpace(const string16& string) {
167 return !string.empty() && *string.rbegin() == ' '; 167 return !string.empty() && *string.rbegin() == ' ';
168 } 168 }
169 169
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 // platform independent in here. 1015 // platform independent in here.
1016 // TODO(ncarter): When this gets cleaned up, the implementation of 1016 // TODO(ncarter): When this gets cleaned up, the implementation of
1017 // CreatePThread can also be removed. 1017 // CreatePThread can also be removed.
1018 #if defined(OS_WIN) 1018 #if defined(OS_WIN)
1019 HANDLE exit_flag = CreateEvent(NULL, TRUE /*manual reset*/, FALSE, NULL); 1019 HANDLE exit_flag = CreateEvent(NULL, TRUE /*manual reset*/, FALSE, NULL);
1020 address_watch_params_.exit_flag = exit_flag; 1020 address_watch_params_.exit_flag = exit_flag;
1021 #endif 1021 #endif
1022 address_watch_params_.conn_mgr = connection_manager(); 1022 address_watch_params_.conn_mgr = connection_manager();
1023 address_watch_thread_ = CreatePThread(AddressWatchThread, 1023 address_watch_thread_ = CreatePThread(AddressWatchThread,
1024 &address_watch_params_); 1024 &address_watch_params_);
1025 #if defined(OS_WIN)
1025 DCHECK(NULL != address_watch_thread_); 1026 DCHECK(NULL != address_watch_thread_);
1027 #endif
1026 1028
1027 // Hand over the bridged POST factory to be owned by the connection 1029 // Hand over the bridged POST factory to be owned by the connection
1028 // dir_manager. 1030 // dir_manager.
1029 connection_manager()->SetHttpPostProviderFactory(post_factory); 1031 connection_manager()->SetHttpPostProviderFactory(post_factory);
1030 1032
1031 // Watch various objects for aggregated status. 1033 // Watch various objects for aggregated status.
1032 allstatus()->WatchConnectionManager(connection_manager()); 1034 allstatus()->WatchConnectionManager(connection_manager());
1033 1035
1034 std::string gaia_url = browser_sync::kGaiaUrl; 1036 std::string gaia_url = browser_sync::kGaiaUrl;
1035 const char* service_id = gaia_service_id ? 1037 const char* service_id = gaia_service_id ?
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
1558 BaseTransaction::~BaseTransaction() { 1560 BaseTransaction::~BaseTransaction() {
1559 delete lookup_; 1561 delete lookup_;
1560 } 1562 }
1561 1563
1562 UserShare* SyncManager::GetUserShare() const { 1564 UserShare* SyncManager::GetUserShare() const {
1563 DCHECK(data_->initialized()) << "GetUserShare requires initialization!"; 1565 DCHECK(data_->initialized()) << "GetUserShare requires initialization!";
1564 return data_->GetUserShare(); 1566 return data_->GetUserShare();
1565 } 1567 }
1566 1568
1567 } // namespace sync_api 1569 } // namespace sync_api
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/sync_process_state.cc ('k') | chrome/browser/sync/engine/syncer_proto_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698