OLD | NEW |
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/renderer/render_thread_impl.h" | 5 #include "content/renderer/render_thread_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <map> | 9 #include <map> |
10 #include <vector> | 10 #include <vector> |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 #endif | 477 #endif |
478 | 478 |
479 // Leak shared contexts on other threads, as we can not get to the correct | 479 // Leak shared contexts on other threads, as we can not get to the correct |
480 // thread to destroy them. | 480 // thread to destroy them. |
481 if (offscreen_compositor_contexts_.get()) | 481 if (offscreen_compositor_contexts_.get()) |
482 offscreen_compositor_contexts_->set_leak_on_destroy(); | 482 offscreen_compositor_contexts_->set_leak_on_destroy(); |
483 } | 483 } |
484 | 484 |
485 bool RenderThreadImpl::Send(IPC::Message* msg) { | 485 bool RenderThreadImpl::Send(IPC::Message* msg) { |
486 // Certain synchronous messages cannot always be processed synchronously by | 486 // Certain synchronous messages cannot always be processed synchronously by |
487 // the browser, e.g., Chrome frame communicating with the embedding browser. | 487 // the browser, e.g., putting up UI and waiting for the user. This could cause |
488 // This could cause a complete hang of Chrome if a windowed plug-in is trying | 488 // a complete hang of Chrome if a windowed plug-in is trying to communicate |
489 // to communicate with the renderer thread since the browser's UI thread | 489 // with the renderer thread since the browser's UI thread could be stuck |
490 // could be stuck (within a Windows API call) trying to synchronously | 490 // (within a Windows API call) trying to synchronously communicate with the |
491 // communicate with the plug-in. The remedy is to pump messages on this | 491 // plug-in. The remedy is to pump messages on this thread while the browser |
492 // thread while the browser is processing this request. This creates an | 492 // is processing this request. This creates an opportunity for re-entrancy |
493 // opportunity for re-entrancy into WebKit, so we need to take care to disable | 493 // into WebKit, so we need to take care to disable callbacks, timers, and |
494 // callbacks, timers, and pending network loads that could trigger such | 494 // pending network loads that could trigger such callbacks. |
495 // callbacks. | |
496 bool pumping_events = false; | 495 bool pumping_events = false; |
497 if (msg->is_sync()) { | 496 if (msg->is_sync()) { |
498 if (msg->is_caller_pumping_messages()) { | 497 if (msg->is_caller_pumping_messages()) { |
499 pumping_events = true; | 498 pumping_events = true; |
500 } else { | |
501 if ((msg->type() == ViewHostMsg_GetCookies::ID || | |
502 msg->type() == ViewHostMsg_GetRawCookies::ID || | |
503 msg->type() == ViewHostMsg_CookiesEnabled::ID) && | |
504 GetContentClient()->renderer()-> | |
505 ShouldPumpEventsDuringCookieMessage()) { | |
506 pumping_events = true; | |
507 } | |
508 } | 499 } |
509 } | 500 } |
510 | 501 |
511 bool suspend_webkit_shared_timer = true; // default value | 502 bool suspend_webkit_shared_timer = true; // default value |
512 std::swap(suspend_webkit_shared_timer, suspend_webkit_shared_timer_); | 503 std::swap(suspend_webkit_shared_timer, suspend_webkit_shared_timer_); |
513 | 504 |
514 bool notify_webkit_of_modal_loop = true; // default value | 505 bool notify_webkit_of_modal_loop = true; // default value |
515 std::swap(notify_webkit_of_modal_loop, notify_webkit_of_modal_loop_); | 506 std::swap(notify_webkit_of_modal_loop, notify_webkit_of_modal_loop_); |
516 | 507 |
517 #if defined(ENABLE_PLUGINS) | 508 #if defined(ENABLE_PLUGINS) |
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1369 if (!gamepad_shared_memory_reader_) | 1360 if (!gamepad_shared_memory_reader_) |
1370 gamepad_shared_memory_reader_.reset(new GamepadSharedMemoryReader); | 1361 gamepad_shared_memory_reader_.reset(new GamepadSharedMemoryReader); |
1371 gamepad_shared_memory_reader_->SampleGamepads(*data); | 1362 gamepad_shared_memory_reader_->SampleGamepads(*data); |
1372 } | 1363 } |
1373 | 1364 |
1374 base::ProcessId RenderThreadImpl::renderer_process_id() const { | 1365 base::ProcessId RenderThreadImpl::renderer_process_id() const { |
1375 return renderer_process_id_; | 1366 return renderer_process_id_; |
1376 } | 1367 } |
1377 | 1368 |
1378 } // namespace content | 1369 } // namespace content |
OLD | NEW |