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

Side by Side Diff: content/browser/browser_main_loop.cc

Issue 10824162: add device notification to Mac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed linux bots. Created 8 years, 4 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
« no previous file with comments | « content/browser/browser_main_loop.h ('k') | content/browser/device_monitor_mac.h » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/browser_main_loop.h" 5 #include "content/browser/browser_main_loop.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/hi_res_timer_manager.h" 10 #include "base/hi_res_timer_manager.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 #include "ui/base/l10n/l10n_util_win.h" 61 #include "ui/base/l10n/l10n_util_win.h"
62 #include "net/base/winsock_init.h" 62 #include "net/base/winsock_init.h"
63 #endif 63 #endif
64 64
65 #if defined(OS_LINUX) || defined(OS_OPENBSD) 65 #if defined(OS_LINUX) || defined(OS_OPENBSD)
66 #include <glib-object.h> 66 #include <glib-object.h>
67 #endif 67 #endif
68 68
69 #if defined(OS_LINUX) 69 #if defined(OS_LINUX)
70 #include "content/browser/device_monitor_linux.h" 70 #include "content/browser/device_monitor_linux.h"
71 #elif defined(OS_MACOSX)
72 #include "content/browser/device_monitor_mac.h"
71 #endif 73 #endif
72 74
73 #if defined(OS_CHROMEOS) 75 #if defined(OS_CHROMEOS)
74 #include <dbus/dbus-glib.h> 76 #include <dbus/dbus-glib.h>
75 #endif 77 #endif
76 78
77 #if defined(TOOLKIT_GTK) 79 #if defined(TOOLKIT_GTK)
78 #include "ui/gfx/gtk_util.h" 80 #include "ui/gfx/gtk_util.h"
79 #endif 81 #endif
80 82
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 if (resource_dispatcher_host_.get()) 500 if (resource_dispatcher_host_.get())
499 resource_dispatcher_host_.get()->Shutdown(); 501 resource_dispatcher_host_.get()->Shutdown();
500 502
501 #if defined(USE_AURA) 503 #if defined(USE_AURA)
502 ImageTransportFactory::Terminate(); 504 ImageTransportFactory::Terminate();
503 #endif 505 #endif
504 BrowserGpuChannelHostFactory::Terminate(); 506 BrowserGpuChannelHostFactory::Terminate();
505 507
506 GamepadService::GetInstance()->Terminate(); 508 GamepadService::GetInstance()->Terminate();
507 509
510 // The device monitors are using |system_monitor_| as dependency, so delete
511 // them before |system_monitor_| goes away.
512 // On Mac and windows, the monitor needs to be destroyed on the same thread
513 // as they were created. On Linux, the monitor will be deleted when IO thread
514 // goes away.
515 #if defined(OS_WIN)
516 system_message_window_.reset();
517 #elif defined(OS_MACOSX)
518 device_monitor_mac_.reset();
519 #endif
520
508 // Must be size_t so we can subtract from it. 521 // Must be size_t so we can subtract from it.
509 for (size_t thread_id = BrowserThread::ID_COUNT - 1; 522 for (size_t thread_id = BrowserThread::ID_COUNT - 1;
510 thread_id >= (BrowserThread::UI + 1); 523 thread_id >= (BrowserThread::UI + 1);
511 --thread_id) { 524 --thread_id) {
512 // Find the thread object we want to stop. Looping over all valid 525 // Find the thread object we want to stop. Looping over all valid
513 // BrowserThread IDs and DCHECKing on a missing case in the switch 526 // BrowserThread IDs and DCHECKing on a missing case in the switch
514 // statement helps avoid a mismatch between this code and the 527 // statement helps avoid a mismatch between this code and the
515 // BrowserThread::ID enumeration. 528 // BrowserThread::ID enumeration.
516 // 529 //
517 // The destruction order is the reverse order of occurrence in the 530 // The destruction order is the reverse order of occurrence in the
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 void BrowserMainLoop::BrowserThreadsStarted() { 625 void BrowserMainLoop::BrowserThreadsStarted() {
613 HistogramSynchronizer::GetInstance(); 626 HistogramSynchronizer::GetInstance();
614 627
615 content::BrowserGpuChannelHostFactory::Initialize(); 628 content::BrowserGpuChannelHostFactory::Initialize();
616 #if defined(USE_AURA) 629 #if defined(USE_AURA)
617 ImageTransportFactory::Initialize(); 630 ImageTransportFactory::Initialize();
618 #endif 631 #endif
619 632
620 #if defined(OS_LINUX) 633 #if defined(OS_LINUX)
621 device_monitor_linux_.reset(new DeviceMonitorLinux()); 634 device_monitor_linux_.reset(new DeviceMonitorLinux());
635 #elif defined(OS_MACOSX)
636 device_monitor_mac_.reset(new DeviceMonitorMac());
622 #endif 637 #endif
623 638
624 // RDH needs the IO thread to be created. 639 // RDH needs the IO thread to be created.
625 resource_dispatcher_host_.reset(new ResourceDispatcherHostImpl()); 640 resource_dispatcher_host_.reset(new ResourceDispatcherHostImpl());
626 641
627 #if defined(ENABLE_INPUT_SPEECH) 642 #if defined(ENABLE_INPUT_SPEECH)
628 speech_recognition_manager_.reset(new speech::SpeechRecognitionManagerImpl()); 643 speech_recognition_manager_.reset(new speech::SpeechRecognitionManagerImpl());
629 #endif 644 #endif
630 645
631 // Start the GpuDataManager before we set up the MessageLoops because 646 // Start the GpuDataManager before we set up the MessageLoops because
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); 696 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type());
682 if (parameters_.ui_task) 697 if (parameters_.ui_task)
683 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); 698 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task);
684 699
685 base::RunLoop run_loop; 700 base::RunLoop run_loop;
686 run_loop.Run(); 701 run_loop.Run();
687 #endif 702 #endif
688 } 703 }
689 704
690 } // namespace content 705 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_main_loop.h ('k') | content/browser/device_monitor_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698