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

Unified Diff: cloud_print/gcp20/prototype/gcp20_device.cc

Issue 20238002: GCP2.0 Device: XMPP (without pings). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@DEPS-jingle
Patch Set: Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: cloud_print/gcp20/prototype/gcp20_device.cc
diff --git a/cloud_print/gcp20/prototype/gcp20_device.cc b/cloud_print/gcp20/prototype/gcp20_device.cc
index d58adc5f5b543f4d0dc2269f3536a898efbe513f..31025ab5287cdca4e4c8a22ec1abaec18a4375e7 100644
--- a/cloud_print/gcp20/prototype/gcp20_device.cc
+++ b/cloud_print/gcp20/prototype/gcp20_device.cc
@@ -22,10 +22,19 @@ void StartPrinter(Printer* printer) {
}
base::RunLoop* g_runner = NULL;
+Printer* g_printer = NULL;
void OnAbort(int val) {
- if (g_runner)
- g_runner->Quit();
+ if (g_runner) {
+ g_printer->Stop(); // TODO(maksymb): Make this call in safe place call:
+ // |OnAbort| is called from different thread.
+ g_printer = NULL;
+
+ g_runner->Quit(); // Always do after printer.Stop() to make sure XMPP will
+ // be disabled fully before |Quit| will be called
+ // (XMPP disables itself via MessageLoop call).
+ g_runner = NULL;
+ }
}
} // namespace
@@ -45,10 +54,9 @@ int main(int argc, char* argv[]) {
base::MessageLoop::current()->PostTask(FROM_HERE,
base::Bind(&StartPrinter, &printer));
base::RunLoop runner;
+ g_printer = &printer;
g_runner = &runner;
runner.Run();
- g_runner = NULL;
- printer.Stop();
return 0;
}
« no previous file with comments | « cloud_print/gcp20/prototype/cloud_print_xmpp_listener.cc ('k') | cloud_print/gcp20/prototype/gcp20_device.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698