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

Side by Side Diff: chrome/browser/sync/tools/sync_listen_notifications.cc

Issue 8718012: Revert 111695 - Have content/ create and destroy its own threads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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
« no previous file with comments | « chrome/browser/sync/tools/DEPS ('k') | chrome/browser/ui/browser_list.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <cstdio> 5 #include <cstdio>
6 #include <string> 6 #include <string>
7 7
8 #include "base/at_exit.h" 8 #include "base/at_exit.h"
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/message_loop.h" 16 #include "base/message_loop.h"
17 #include "base/threading/thread.h"
18 #include "chrome/browser/sync/notifier/invalidation_version_tracker.h" 17 #include "chrome/browser/sync/notifier/invalidation_version_tracker.h"
19 #include "chrome/browser/sync/notifier/sync_notifier.h" 18 #include "chrome/browser/sync/notifier/sync_notifier.h"
20 #include "chrome/browser/sync/notifier/sync_notifier_factory.h" 19 #include "chrome/browser/sync/notifier/sync_notifier_factory.h"
21 #include "chrome/browser/sync/notifier/sync_notifier_observer.h" 20 #include "chrome/browser/sync/notifier/sync_notifier_observer.h"
22 #include "chrome/browser/sync/syncable/model_type.h" 21 #include "chrome/browser/sync/syncable/model_type.h"
23 #include "chrome/browser/sync/syncable/model_type_payload_map.h" 22 #include "chrome/browser/sync/syncable/model_type_payload_map.h"
24 #include "chrome/test/base/test_url_request_context_getter.h" 23 #include "chrome/test/base/test_url_request_context_getter.h"
25 #include "content/public/browser/browser_thread.h" 24 #include "content/public/browser/browser_thread.h"
26 #include "content/browser/browser_thread_impl.h"
27 25
28 using content::BrowserThread; 26 using content::BrowserThread;
29 27
30 // This is a simple utility that initializes a sync notifier and 28 // This is a simple utility that initializes a sync notifier and
31 // listens to any received notifications. 29 // listens to any received notifications.
32 30
33 namespace { 31 namespace {
34 32
35 // Class to print received notifications events. 33 // Class to print received notifications events.
36 class NotificationPrinter : public sync_notifier::SyncNotifierObserver { 34 class NotificationPrinter : public sync_notifier::SyncNotifierObserver {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 base::AtExitManager exit_manager; 88 base::AtExitManager exit_manager;
91 CommandLine::Init(argc, argv); 89 CommandLine::Init(argc, argv);
92 logging::InitLogging( 90 logging::InitLogging(
93 NULL, 91 NULL,
94 logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, 92 logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG,
95 logging::LOCK_LOG_FILE, 93 logging::LOCK_LOG_FILE,
96 logging::DELETE_OLD_LOG_FILE, 94 logging::DELETE_OLD_LOG_FILE,
97 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); 95 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS);
98 96
99 MessageLoop ui_loop; 97 MessageLoop ui_loop;
100 content::BrowserThreadImpl ui_thread(BrowserThread::UI, &ui_loop); 98 content::DeprecatedBrowserThread ui_thread(BrowserThread::UI, &ui_loop);
101 content::BrowserThreadImpl io_thread(BrowserThread::IO); 99
100 content::DeprecatedBrowserThread io_thread(BrowserThread::IO);
102 base::Thread::Options options; 101 base::Thread::Options options;
103 options.message_loop_type = MessageLoop::TYPE_IO; 102 options.message_loop_type = MessageLoop::TYPE_IO;
104 io_thread.StartWithOptions(options); 103 io_thread.StartWithOptions(options);
105 104
106 // Parse command line. 105 // Parse command line.
107 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 106 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
108 std::string email = command_line.GetSwitchValueASCII("email"); 107 std::string email = command_line.GetSwitchValueASCII("email");
109 std::string token = command_line.GetSwitchValueASCII("token"); 108 std::string token = command_line.GetSwitchValueASCII("token");
110 // TODO(akalin): Write a wrapper script that gets a token for an 109 // TODO(akalin): Write a wrapper script that gets a token for an
111 // email and password and passes that in to this utility. 110 // email and password and passes that in to this utility.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 } 144 }
146 sync_notifier->UpdateEnabledTypes(types); 145 sync_notifier->UpdateEnabledTypes(types);
147 } 146 }
148 147
149 ui_loop.Run(); 148 ui_loop.Run();
150 149
151 sync_notifier->RemoveObserver(&notification_printer); 150 sync_notifier->RemoveObserver(&notification_printer);
152 io_thread.Stop(); 151 io_thread.Stop();
153 return 0; 152 return 0;
154 } 153 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/tools/DEPS ('k') | chrome/browser/ui/browser_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698