OLD | NEW |
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 "content/browser/browser_main_loop.h" | 5 #include "content/browser/browser_main_loop.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 BrowserMainLoop::BrowserMainLoop(const content::MainFunctionParams& parameters) | 151 BrowserMainLoop::BrowserMainLoop(const content::MainFunctionParams& parameters) |
152 : parameters_(parameters), | 152 : parameters_(parameters), |
153 parsed_command_line_(parameters.command_line), | 153 parsed_command_line_(parameters.command_line), |
154 result_code_(content::RESULT_CODE_NORMAL_EXIT) { | 154 result_code_(content::RESULT_CODE_NORMAL_EXIT) { |
155 #if defined(OS_WIN) | 155 #if defined(OS_WIN) |
156 OleInitialize(NULL); | 156 OleInitialize(NULL); |
157 #endif | 157 #endif |
158 } | 158 } |
159 | 159 |
160 BrowserMainLoop::~BrowserMainLoop() { | 160 BrowserMainLoop::~BrowserMainLoop() { |
| 161 // Release/destroy parts here, before OleUninitialize() and before other |
| 162 // members are destroyed (in particular main_message_loop_). |
| 163 parts_.reset(); |
| 164 |
161 #if defined(OS_WIN) | 165 #if defined(OS_WIN) |
162 OleUninitialize(); | 166 OleUninitialize(); |
163 #endif | 167 #endif |
164 } | 168 } |
165 | 169 |
166 void BrowserMainLoop::Init() { | 170 void BrowserMainLoop::Init() { |
167 parts_.reset( | 171 parts_.reset( |
168 GetContentClient()->browser()->CreateBrowserMainParts(parameters_)); | 172 GetContentClient()->browser()->CreateBrowserMainParts(parameters_)); |
169 } | 173 } |
170 | 174 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 MessageLoopForUI::current()->PostTask(FROM_HERE, parameters_.ui_task); | 344 MessageLoopForUI::current()->PostTask(FROM_HERE, parameters_.ui_task); |
341 | 345 |
342 #if defined(OS_MACOSX) | 346 #if defined(OS_MACOSX) |
343 MessageLoopForUI::current()->Run(); | 347 MessageLoopForUI::current()->Run(); |
344 #else | 348 #else |
345 MessageLoopForUI::current()->RunWithDispatcher(NULL); | 349 MessageLoopForUI::current()->RunWithDispatcher(NULL); |
346 #endif | 350 #endif |
347 } | 351 } |
348 | 352 |
349 } // namespace content | 353 } // namespace content |
OLD | NEW |