| 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/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/logging.h" | 10 #include "base/logging.h" |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 thread_to_start = &process_launcher_thread_; | 342 thread_to_start = &process_launcher_thread_; |
| 343 break; | 343 break; |
| 344 case BrowserThread::CACHE: | 344 case BrowserThread::CACHE: |
| 345 thread_to_start = &cache_thread_; | 345 thread_to_start = &cache_thread_; |
| 346 options = &io_message_loop_options; | 346 options = &io_message_loop_options; |
| 347 break; | 347 break; |
| 348 case BrowserThread::IO: | 348 case BrowserThread::IO: |
| 349 thread_to_start = &io_thread_; | 349 thread_to_start = &io_thread_; |
| 350 options = &io_message_loop_options; | 350 options = &io_message_loop_options; |
| 351 break; | 351 break; |
| 352 #if defined(OS_CHROMEOS) | |
| 353 case BrowserThread::WEB_SOCKET_PROXY: | |
| 354 thread_to_start = &web_socket_proxy_thread_; | |
| 355 options = &io_message_loop_options; | |
| 356 break; | |
| 357 #endif | |
| 358 case BrowserThread::UI: | 352 case BrowserThread::UI: |
| 359 case BrowserThread::ID_COUNT: | 353 case BrowserThread::ID_COUNT: |
| 360 default: | 354 default: |
| 361 NOTREACHED(); | 355 NOTREACHED(); |
| 362 break; | 356 break; |
| 363 } | 357 } |
| 364 | 358 |
| 365 BrowserThread::ID id = static_cast<BrowserThread::ID>(thread_id); | 359 BrowserThread::ID id = static_cast<BrowserThread::ID>(thread_id); |
| 366 | 360 |
| 367 if (parts_.get()) | 361 if (parts_.get()) |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 --thread_id) { | 416 --thread_id) { |
| 423 // Find the thread object we want to stop. Looping over all valid | 417 // Find the thread object we want to stop. Looping over all valid |
| 424 // BrowserThread IDs and DCHECKing on a missing case in the switch | 418 // BrowserThread IDs and DCHECKing on a missing case in the switch |
| 425 // statement helps avoid a mismatch between this code and the | 419 // statement helps avoid a mismatch between this code and the |
| 426 // BrowserThread::ID enumeration. | 420 // BrowserThread::ID enumeration. |
| 427 // | 421 // |
| 428 // The destruction order is the reverse order of occurrence in the | 422 // The destruction order is the reverse order of occurrence in the |
| 429 // BrowserThread::ID list. The rationale for the order is as | 423 // BrowserThread::ID list. The rationale for the order is as |
| 430 // follows (need to be filled in a bit): | 424 // follows (need to be filled in a bit): |
| 431 // | 425 // |
| 432 // - (Not sure why the WEB_SOCKET_PROXY thread is stopped first.) | |
| 433 // | 426 // |
| 434 // - The IO thread is the only user of the CACHE thread. | 427 // - The IO thread is the only user of the CACHE thread. |
| 435 // | 428 // |
| 436 // - The PROCESS_LAUNCHER thread must be stopped after IO in case | 429 // - The PROCESS_LAUNCHER thread must be stopped after IO in case |
| 437 // the IO thread posted a task to terminate a process on the | 430 // the IO thread posted a task to terminate a process on the |
| 438 // process launcher thread. | 431 // process launcher thread. |
| 439 // | 432 // |
| 440 // - (Not sure why FILE needs to stop before WEBKIT.) | 433 // - (Not sure why FILE needs to stop before WEBKIT.) |
| 441 // | 434 // |
| 442 // - The WEBKIT thread (which currently is the responsibility of | 435 // - The WEBKIT thread (which currently is the responsibility of |
| (...skipping 18 matching lines...) Expand all Loading... |
| 461 break; | 454 break; |
| 462 case BrowserThread::PROCESS_LAUNCHER: | 455 case BrowserThread::PROCESS_LAUNCHER: |
| 463 thread_to_stop = &process_launcher_thread_; | 456 thread_to_stop = &process_launcher_thread_; |
| 464 break; | 457 break; |
| 465 case BrowserThread::CACHE: | 458 case BrowserThread::CACHE: |
| 466 thread_to_stop = &cache_thread_; | 459 thread_to_stop = &cache_thread_; |
| 467 break; | 460 break; |
| 468 case BrowserThread::IO: | 461 case BrowserThread::IO: |
| 469 thread_to_stop = &io_thread_; | 462 thread_to_stop = &io_thread_; |
| 470 break; | 463 break; |
| 471 #if defined(OS_CHROMEOS) | |
| 472 case BrowserThread::WEB_SOCKET_PROXY: | |
| 473 thread_to_stop = &web_socket_proxy_thread_; | |
| 474 break; | |
| 475 #endif | |
| 476 case BrowserThread::UI: | 464 case BrowserThread::UI: |
| 477 case BrowserThread::ID_COUNT: | 465 case BrowserThread::ID_COUNT: |
| 478 default: | 466 default: |
| 479 NOTREACHED(); | 467 NOTREACHED(); |
| 480 break; | 468 break; |
| 481 } | 469 } |
| 482 | 470 |
| 483 BrowserThread::ID id = static_cast<BrowserThread::ID>(thread_id); | 471 BrowserThread::ID id = static_cast<BrowserThread::ID>(thread_id); |
| 484 | 472 |
| 485 if (parts_.get()) | 473 if (parts_.get()) |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); | 548 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); |
| 561 | 549 |
| 562 #if defined(OS_MACOSX) | 550 #if defined(OS_MACOSX) |
| 563 MessageLoopForUI::current()->Run(); | 551 MessageLoopForUI::current()->Run(); |
| 564 #else | 552 #else |
| 565 MessageLoopForUI::current()->RunWithDispatcher(NULL); | 553 MessageLoopForUI::current()->RunWithDispatcher(NULL); |
| 566 #endif | 554 #endif |
| 567 } | 555 } |
| 568 | 556 |
| 569 } // namespace content | 557 } // namespace content |
| OLD | NEW |