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/renderer/render_thread.h" | 5 #include "content/renderer/render_thread.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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 #include "ipc/ipc_channel_handle.h" | 49 #include "ipc/ipc_channel_handle.h" |
50 #include "ipc/ipc_platform_file.h" | 50 #include "ipc/ipc_platform_file.h" |
51 #include "net/base/net_errors.h" | 51 #include "net/base/net_errors.h" |
52 #include "net/base/net_util.h" | 52 #include "net/base/net_util.h" |
53 #include "third_party/tcmalloc/chromium/src/google/malloc_extension.h" | 53 #include "third_party/tcmalloc/chromium/src/google/malloc_extension.h" |
54 #include "third_party/WebKit/Source/WebKit/chromium/public/WebColor.h" | 54 #include "third_party/WebKit/Source/WebKit/chromium/public/WebColor.h" |
55 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDatabase.h" | 55 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDatabase.h" |
56 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 56 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
57 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 57 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
58 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" | 58 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" |
59 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNetworkStateNotifi er.h" | |
59 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h" | 60 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h" |
60 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptController.h " | 61 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptController.h " |
61 #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageEventDispat cher.h" | 62 #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageEventDispat cher.h" |
62 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 63 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
63 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 64 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
64 #include "v8/include/v8.h" | 65 #include "v8/include/v8.h" |
65 #include "webkit/extensions/v8/benchmarking_extension.h" | 66 #include "webkit/extensions/v8/benchmarking_extension.h" |
66 #include "webkit/extensions/v8/playback_extension.h" | 67 #include "webkit/extensions/v8/playback_extension.h" |
67 #include "webkit/glue/webkit_glue.h" | 68 #include "webkit/glue/webkit_glue.h" |
68 | 69 |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
391 bool handled = true; | 392 bool handled = true; |
392 IPC_BEGIN_MESSAGE_MAP(RenderThread, msg) | 393 IPC_BEGIN_MESSAGE_MAP(RenderThread, msg) |
393 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForCurrentURL, | 394 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForCurrentURL, |
394 OnSetZoomLevelForCurrentURL) | 395 OnSetZoomLevelForCurrentURL) |
395 IPC_MESSAGE_HANDLER(ViewMsg_SetNextPageID, OnSetNextPageID) | 396 IPC_MESSAGE_HANDLER(ViewMsg_SetNextPageID, OnSetNextPageID) |
396 IPC_MESSAGE_HANDLER(ViewMsg_SetCSSColors, OnSetCSSColors) | 397 IPC_MESSAGE_HANDLER(ViewMsg_SetCSSColors, OnSetCSSColors) |
397 // TODO(port): removed from render_messages_internal.h; | 398 // TODO(port): removed from render_messages_internal.h; |
398 // is there a new non-windows message I should add here? | 399 // is there a new non-windows message I should add here? |
399 IPC_MESSAGE_HANDLER(ViewMsg_New, OnCreateNewView) | 400 IPC_MESSAGE_HANDLER(ViewMsg_New, OnCreateNewView) |
400 IPC_MESSAGE_HANDLER(ViewMsg_PurgePluginListCache, OnPurgePluginListCache) | 401 IPC_MESSAGE_HANDLER(ViewMsg_PurgePluginListCache, OnPurgePluginListCache) |
402 IPC_MESSAGE_HANDLER(ViewMsg_NetworkStateChanged, OnNetworkStateChanged) | |
401 IPC_MESSAGE_HANDLER(DOMStorageMsg_Event, OnDOMStorageEvent) | 403 IPC_MESSAGE_HANDLER(DOMStorageMsg_Event, OnDOMStorageEvent) |
402 IPC_MESSAGE_UNHANDLED(handled = false) | 404 IPC_MESSAGE_UNHANDLED(handled = false) |
403 IPC_END_MESSAGE_MAP() | 405 IPC_END_MESSAGE_MAP() |
404 return handled; | 406 return handled; |
405 } | 407 } |
406 | 408 |
407 void RenderThread::OnSetNextPageID(int32 next_page_id) { | 409 void RenderThread::OnSetNextPageID(int32 next_page_id) { |
408 // This should only be called at process initialization time, so we shouldn't | 410 // This should only be called at process initialization time, so we shouldn't |
409 // have to worry about thread-safety. | 411 // have to worry about thread-safety. |
410 RenderView::SetNextPageID(next_page_id); | 412 RenderView::SetNextPageID(next_page_id); |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
662 EnsureWebKitInitialized(); | 664 EnsureWebKitInitialized(); |
663 // The call below will cause a GetPlugins call with refresh=true, but at this | 665 // The call below will cause a GetPlugins call with refresh=true, but at this |
664 // point we already know that the browser has refreshed its list, so disable | 666 // point we already know that the browser has refreshed its list, so disable |
665 // refresh temporarily to prevent each renderer process causing the list to be | 667 // refresh temporarily to prevent each renderer process causing the list to be |
666 // regenerated. | 668 // regenerated. |
667 plugin_refresh_allowed_ = false; | 669 plugin_refresh_allowed_ = false; |
668 WebKit::resetPluginCache(reload_pages); | 670 WebKit::resetPluginCache(reload_pages); |
669 plugin_refresh_allowed_ = true; | 671 plugin_refresh_allowed_ = true; |
670 } | 672 } |
671 | 673 |
674 void RenderThread::OnNetworkStateChanged(bool online) { | |
675 EnsureWebKitInitialized(); | |
676 WebKit::WebNetworkStateNotifier::setOnLine(online); | |
darin (slow to review)
2011/07/01 18:19:15
nit: convention is to add a using directive at the
adamk
2011/07/01 18:48:06
Done.
| |
677 } | |
678 | |
672 scoped_refptr<base::MessageLoopProxy> | 679 scoped_refptr<base::MessageLoopProxy> |
673 RenderThread::GetFileThreadMessageLoopProxy() { | 680 RenderThread::GetFileThreadMessageLoopProxy() { |
674 DCHECK(message_loop() == MessageLoop::current()); | 681 DCHECK(message_loop() == MessageLoop::current()); |
675 if (!file_thread_.get()) { | 682 if (!file_thread_.get()) { |
676 file_thread_.reset(new base::Thread("Renderer::FILE")); | 683 file_thread_.reset(new base::Thread("Renderer::FILE")); |
677 file_thread_->Start(); | 684 file_thread_->Start(); |
678 } | 685 } |
679 return file_thread_->message_loop_proxy(); | 686 return file_thread_->message_loop_proxy(); |
680 } | 687 } |
681 | 688 |
682 void RenderThread::RegisterExtension(v8::Extension* extension) { | 689 void RenderThread::RegisterExtension(v8::Extension* extension) { |
683 WebScriptController::registerExtension(extension); | 690 WebScriptController::registerExtension(extension); |
684 v8_extensions_.insert(extension->name()); | 691 v8_extensions_.insert(extension->name()); |
685 } | 692 } |
686 | 693 |
687 bool RenderThread::IsRegisteredExtension( | 694 bool RenderThread::IsRegisteredExtension( |
688 const std::string& v8_extension_name) const { | 695 const std::string& v8_extension_name) const { |
689 return v8_extensions_.find(v8_extension_name) != v8_extensions_.end(); | 696 return v8_extensions_.find(v8_extension_name) != v8_extensions_.end(); |
690 } | 697 } |
OLD | NEW |