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

Side by Side Diff: components/sync/driver/sync_stopped_reporter.cc

Issue 2481923002: [WIP] make GURL::path() return a StringPiece (Closed)
Patch Set: thanks asan Created 4 years, 1 month 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
OLDNEW
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 "components/sync/driver/sync_stopped_reporter.h" 5 #include "components/sync/driver/sync_stopped_reporter.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 void SyncStoppedReporter::OnTimeout() { 91 void SyncStoppedReporter::OnTimeout() {
92 fetcher_.reset(); 92 fetcher_.reset();
93 if (!callback_.is_null()) { 93 if (!callback_.is_null()) {
94 base::ThreadTaskRunnerHandle::Get()->PostTask( 94 base::ThreadTaskRunnerHandle::Get()->PostTask(
95 FROM_HERE, base::Bind(callback_, RESULT_TIMEOUT)); 95 FROM_HERE, base::Bind(callback_, RESULT_TIMEOUT));
96 } 96 }
97 } 97 }
98 98
99 // Static. 99 // Static.
100 GURL SyncStoppedReporter::GetSyncEventURL(const GURL& sync_service_url) { 100 GURL SyncStoppedReporter::GetSyncEventURL(const GURL& sync_service_url) {
101 std::string path = sync_service_url.path(); 101 std::string path = sync_service_url.path().as_string();
102 if (path.empty() || *path.rbegin() != '/') { 102 if (path.empty() || *path.rbegin() != '/') {
103 path += '/'; 103 path += '/';
104 } 104 }
105 path += kEventEndpoint; 105 path += kEventEndpoint;
106 GURL::Replacements replacements; 106 GURL::Replacements replacements;
107 replacements.SetPathStr(path); 107 replacements.SetPathStr(path);
108 return sync_service_url.ReplaceComponents(replacements); 108 return sync_service_url.ReplaceComponents(replacements);
109 } 109 }
110 110
111 void SyncStoppedReporter::SetTimerTaskRunnerForTest( 111 void SyncStoppedReporter::SetTimerTaskRunnerForTest(
112 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) { 112 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) {
113 timer_.SetTaskRunner(task_runner); 113 timer_.SetTaskRunner(task_runner);
114 } 114 }
115 115
116 } // namespace syncer 116 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698