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

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

Issue 11087007: Build browser_main_loop.cc on iOS. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 2 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
« no previous file with comments | « no previous file | content/content_browser.gypi » ('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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 #include "ui/base/l10n/l10n_util_win.h" 60 #include "ui/base/l10n/l10n_util_win.h"
61 #include "net/base/winsock_init.h" 61 #include "net/base/winsock_init.h"
62 #endif 62 #endif
63 63
64 #if defined(OS_LINUX) || defined(OS_OPENBSD) 64 #if defined(OS_LINUX) || defined(OS_OPENBSD)
65 #include <glib-object.h> 65 #include <glib-object.h>
66 #endif 66 #endif
67 67
68 #if defined(OS_LINUX) 68 #if defined(OS_LINUX)
69 #include "content/browser/device_monitor_linux.h" 69 #include "content/browser/device_monitor_linux.h"
70 #elif defined(OS_MACOSX) 70 #elif defined(OS_MACOSX) && !defined(OS_IOS)
71 #include "content/browser/device_monitor_mac.h" 71 #include "content/browser/device_monitor_mac.h"
72 #endif 72 #endif
73 73
74 #if defined(OS_CHROMEOS) 74 #if defined(OS_CHROMEOS)
75 #include <dbus/dbus-glib.h> 75 #include <dbus/dbus-glib.h>
76 #endif 76 #endif
77 77
78 #if defined(TOOLKIT_GTK) 78 #if defined(TOOLKIT_GTK)
79 #include "ui/gfx/gtk_util.h" 79 #include "ui/gfx/gtk_util.h"
80 #endif 80 #endif
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 BrowserMainLoop::BrowserMainLoop(const content::MainFunctionParams& parameters) 233 BrowserMainLoop::BrowserMainLoop(const content::MainFunctionParams& parameters)
234 : parameters_(parameters), 234 : parameters_(parameters),
235 parsed_command_line_(parameters.command_line), 235 parsed_command_line_(parameters.command_line),
236 result_code_(content::RESULT_CODE_NORMAL_EXIT) { 236 result_code_(content::RESULT_CODE_NORMAL_EXIT) {
237 DCHECK(!g_current_browser_main_loop); 237 DCHECK(!g_current_browser_main_loop);
238 g_current_browser_main_loop = this; 238 g_current_browser_main_loop = this;
239 } 239 }
240 240
241 BrowserMainLoop::~BrowserMainLoop() { 241 BrowserMainLoop::~BrowserMainLoop() {
242 DCHECK_EQ(this, g_current_browser_main_loop); 242 DCHECK_EQ(this, g_current_browser_main_loop);
243 #if !defined(OS_IOS)
243 ui::Clipboard::DestroyClipboardForCurrentThread(); 244 ui::Clipboard::DestroyClipboardForCurrentThread();
245 #endif // !defined(OS_IOS)
244 g_current_browser_main_loop = NULL; 246 g_current_browser_main_loop = NULL;
245 } 247 }
246 248
247 void BrowserMainLoop::Init() { 249 void BrowserMainLoop::Init() {
248 parts_.reset( 250 parts_.reset(
249 GetContentClient()->browser()->CreateBrowserMainParts(parameters_)); 251 GetContentClient()->browser()->CreateBrowserMainParts(parameters_));
250 } 252 }
251 253
252 // BrowserMainLoop stages ================================================== 254 // BrowserMainLoop stages ==================================================
253 255
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 } 613 }
612 614
613 // Close the blocking I/O pool after the other threads. Other threads such 615 // Close the blocking I/O pool after the other threads. Other threads such
614 // as the I/O thread may need to schedule work like closing files or flushing 616 // as the I/O thread may need to schedule work like closing files or flushing
615 // data during shutdown, so the blocking pool needs to be available. There 617 // data during shutdown, so the blocking pool needs to be available. There
616 // may also be slow operations pending that will blcok shutdown, so closing 618 // may also be slow operations pending that will blcok shutdown, so closing
617 // it here (which will block until required operations are complete) gives 619 // it here (which will block until required operations are complete) gives
618 // more head start for those operations to finish. 620 // more head start for those operations to finish.
619 BrowserThreadImpl::ShutdownThreadPool(); 621 BrowserThreadImpl::ShutdownThreadPool();
620 622
623 #if !defined(OS_IOS)
621 // Must happen after the I/O thread is shutdown since this class lives on the 624 // Must happen after the I/O thread is shutdown since this class lives on the
622 // I/O thread and isn't threadsafe. 625 // I/O thread and isn't threadsafe.
623 GamepadService::GetInstance()->Terminate(); 626 GamepadService::GetInstance()->Terminate();
627 #endif // !defined(OS_IOS)
624 628
625 if (parts_.get()) 629 if (parts_.get())
626 parts_->PostDestroyThreads(); 630 parts_->PostDestroyThreads();
627 } 631 }
628 632
629 void BrowserMainLoop::InitializeMainThread() { 633 void BrowserMainLoop::InitializeMainThread() {
630 const char* kThreadName = "CrBrowserMain"; 634 const char* kThreadName = "CrBrowserMain";
631 base::PlatformThread::SetName(kThreadName); 635 base::PlatformThread::SetName(kThreadName);
632 if (main_message_loop_.get()) 636 if (main_message_loop_.get())
633 main_message_loop_->set_thread_name(kThreadName); 637 main_message_loop_->set_thread_name(kThreadName);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 // Alert the clipboard class to which threads are allowed to access the 672 // Alert the clipboard class to which threads are allowed to access the
669 // clipboard: 673 // clipboard:
670 std::vector<base::PlatformThreadId> allowed_clipboard_threads; 674 std::vector<base::PlatformThreadId> allowed_clipboard_threads;
671 // The current thread is the UI thread. 675 // The current thread is the UI thread.
672 allowed_clipboard_threads.push_back(base::PlatformThread::CurrentId()); 676 allowed_clipboard_threads.push_back(base::PlatformThread::CurrentId());
673 #if defined(OS_WIN) 677 #if defined(OS_WIN)
674 // On Windows, clipboards are also used on the File or IO threads. 678 // On Windows, clipboards are also used on the File or IO threads.
675 allowed_clipboard_threads.push_back(file_thread_->thread_id()); 679 allowed_clipboard_threads.push_back(file_thread_->thread_id());
676 allowed_clipboard_threads.push_back(io_thread_->thread_id()); 680 allowed_clipboard_threads.push_back(io_thread_->thread_id());
677 #endif 681 #endif
682 #if !defined(OS_IOS)
stuartmorgan 2012/10/08 13:59:39 Move this up to the beginning of the block (just b
msarda 2012/10/08 14:05:39 Done.
678 ui::Clipboard::SetAllowedThreads(allowed_clipboard_threads); 683 ui::Clipboard::SetAllowedThreads(allowed_clipboard_threads);
684 #endif // !defined(OS_IOS)
679 } 685 }
680 686
681 void BrowserMainLoop::InitializeToolkit() { 687 void BrowserMainLoop::InitializeToolkit() {
682 // TODO(evan): this function is rather subtle, due to the variety 688 // TODO(evan): this function is rather subtle, due to the variety
683 // of intersecting ifdefs we have. To keep it easy to follow, there 689 // of intersecting ifdefs we have. To keep it easy to follow, there
684 // are no #else branches on any #ifs. 690 // are no #else branches on any #ifs.
685 // TODO(stevenjb): Move platform specific code into platform specific Parts 691 // TODO(stevenjb): Move platform specific code into platform specific Parts
686 // (Need to add InitializeToolkit stage to BrowserParts). 692 // (Need to add InitializeToolkit stage to BrowserParts).
687 #if defined(OS_LINUX) || defined(OS_OPENBSD) 693 #if defined(OS_LINUX) || defined(OS_OPENBSD)
688 // Glib type system initialization. Needed at least for gconf, 694 // Glib type system initialization. Needed at least for gconf,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); 732 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type());
727 if (parameters_.ui_task) 733 if (parameters_.ui_task)
728 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); 734 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task);
729 735
730 base::RunLoop run_loop; 736 base::RunLoop run_loop;
731 run_loop.Run(); 737 run_loop.Run();
732 #endif 738 #endif
733 } 739 }
734 740
735 } // namespace content 741 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698