| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 59 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 60 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" | 60 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" |
| 61 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNetworkStateNotifi
er.h" | 61 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNetworkStateNotifi
er.h" |
| 62 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupMenu.h" | 62 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupMenu.h" |
| 63 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h" | 63 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h" |
| 64 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptController.h
" | 64 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptController.h
" |
| 65 #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageEventDispat
cher.h" | 65 #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageEventDispat
cher.h" |
| 66 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 66 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
| 67 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 67 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 68 #include "v8/include/v8.h" | 68 #include "v8/include/v8.h" |
| 69 #include "webkit/extensions/v8/benchmarking_extension.h" | |
| 70 #include "webkit/extensions/v8/playback_extension.h" | 69 #include "webkit/extensions/v8/playback_extension.h" |
| 71 #include "webkit/glue/webkit_glue.h" | 70 #include "webkit/glue/webkit_glue.h" |
| 72 | 71 |
| 73 // TODO(port) | 72 // TODO(port) |
| 74 #if defined(OS_WIN) | 73 #if defined(OS_WIN) |
| 75 #include "content/plugin/plugin_channel.h" | 74 #include "content/plugin/plugin_channel.h" |
| 76 #else | 75 #else |
| 77 #include "base/memory/scoped_handle.h" | 76 #include "base/memory/scoped_handle.h" |
| 78 #include "content/plugin/plugin_channel_base.h" | 77 #include "content/plugin/plugin_channel_base.h" |
| 79 #endif | 78 #endif |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 webkit_platform_support_.reset(new RendererWebKitPlatformSupportImpl); | 424 webkit_platform_support_.reset(new RendererWebKitPlatformSupportImpl); |
| 426 WebKit::initialize(webkit_platform_support_.get()); | 425 WebKit::initialize(webkit_platform_support_.get()); |
| 427 | 426 |
| 428 WebScriptController::enableV8SingleThreadMode(); | 427 WebScriptController::enableV8SingleThreadMode(); |
| 429 | 428 |
| 430 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 429 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 431 | 430 |
| 432 webkit_glue::EnableWebCoreLogChannels( | 431 webkit_glue::EnableWebCoreLogChannels( |
| 433 command_line.GetSwitchValueASCII(switches::kWebCoreLogChannels)); | 432 command_line.GetSwitchValueASCII(switches::kWebCoreLogChannels)); |
| 434 | 433 |
| 435 if (command_line.HasSwitch(switches::kEnableBenchmarking)) | |
| 436 RegisterExtension(extensions_v8::BenchmarkingExtension::Get()); | |
| 437 | |
| 438 if (command_line.HasSwitch(switches::kPlaybackMode) || | 434 if (command_line.HasSwitch(switches::kPlaybackMode) || |
| 439 command_line.HasSwitch(switches::kRecordMode) || | 435 command_line.HasSwitch(switches::kRecordMode) || |
| 440 command_line.HasSwitch(switches::kNoJsRandomness)) { | 436 command_line.HasSwitch(switches::kNoJsRandomness)) { |
| 441 RegisterExtension(extensions_v8::PlaybackExtension::Get()); | 437 RegisterExtension(extensions_v8::PlaybackExtension::Get()); |
| 442 } | 438 } |
| 443 | 439 |
| 444 web_database_observer_impl_.reset(new WebDatabaseObserverImpl(this)); | 440 web_database_observer_impl_.reset(new WebDatabaseObserverImpl(this)); |
| 445 WebKit::WebDatabase::setObserver(web_database_observer_impl_.get()); | 441 WebKit::WebDatabase::setObserver(web_database_observer_impl_.get()); |
| 446 | 442 |
| 447 WebRuntimeFeatures::enableSockets( | 443 WebRuntimeFeatures::enableSockets( |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 params.parent_window, | 576 params.parent_window, |
| 581 MSG_ROUTING_NONE, | 577 MSG_ROUTING_NONE, |
| 582 params.renderer_preferences, | 578 params.renderer_preferences, |
| 583 params.web_preferences, | 579 params.web_preferences, |
| 584 new SharedRenderViewCounter(0), | 580 new SharedRenderViewCounter(0), |
| 585 params.view_id, | 581 params.view_id, |
| 586 params.session_storage_namespace_id, | 582 params.session_storage_namespace_id, |
| 587 params.frame_name); | 583 params.frame_name); |
| 588 } | 584 } |
| 589 | 585 |
| 590 void RenderThread::CloseCurrentConnections() { | |
| 591 Send(new ViewHostMsg_CloseCurrentConnections()); | |
| 592 } | |
| 593 | |
| 594 void RenderThread::SetCacheMode(bool enabled) { | |
| 595 Send(new ViewHostMsg_SetCacheMode(enabled)); | |
| 596 } | |
| 597 | |
| 598 void RenderThread::ClearCache(bool preserve_ssl_host_info) { | |
| 599 int rv; | |
| 600 Send(new ViewHostMsg_ClearCache(preserve_ssl_host_info, &rv)); | |
| 601 } | |
| 602 | |
| 603 void RenderThread::ClearHostResolverCache() { | |
| 604 int rv; | |
| 605 Send(new ViewHostMsg_ClearHostResolverCache(&rv)); | |
| 606 } | |
| 607 | |
| 608 void RenderThread::ClearPredictorCache() { | |
| 609 int rv; | |
| 610 Send(new ViewHostMsg_ClearPredictorCache(&rv)); | |
| 611 } | |
| 612 | |
| 613 void RenderThread::EnableSpdy(bool enable) { | |
| 614 Send(new ViewHostMsg_EnableSpdy(enable)); | |
| 615 } | |
| 616 | |
| 617 GpuChannelHost* RenderThread::EstablishGpuChannelSync( | 586 GpuChannelHost* RenderThread::EstablishGpuChannelSync( |
| 618 content::CauseForGpuLaunch cause_for_gpu_launch) { | 587 content::CauseForGpuLaunch cause_for_gpu_launch) { |
| 619 if (gpu_channel_.get()) { | 588 if (gpu_channel_.get()) { |
| 620 // Do nothing if we already have a GPU channel or are already | 589 // Do nothing if we already have a GPU channel or are already |
| 621 // establishing one. | 590 // establishing one. |
| 622 if (gpu_channel_->state() == GpuChannelHost::kUnconnected || | 591 if (gpu_channel_->state() == GpuChannelHost::kUnconnected || |
| 623 gpu_channel_->state() == GpuChannelHost::kConnected) | 592 gpu_channel_->state() == GpuChannelHost::kConnected) |
| 624 return GetGpuChannel(); | 593 return GetGpuChannel(); |
| 625 | 594 |
| 626 // Recreate the channel if it has been lost. | 595 // Recreate the channel if it has been lost. |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 | 690 |
| 722 void RenderThread::RegisterExtension(v8::Extension* extension) { | 691 void RenderThread::RegisterExtension(v8::Extension* extension) { |
| 723 WebScriptController::registerExtension(extension); | 692 WebScriptController::registerExtension(extension); |
| 724 v8_extensions_.insert(extension->name()); | 693 v8_extensions_.insert(extension->name()); |
| 725 } | 694 } |
| 726 | 695 |
| 727 bool RenderThread::IsRegisteredExtension( | 696 bool RenderThread::IsRegisteredExtension( |
| 728 const std::string& v8_extension_name) const { | 697 const std::string& v8_extension_name) const { |
| 729 return v8_extensions_.find(v8_extension_name) != v8_extensions_.end(); | 698 return v8_extensions_.find(v8_extension_name) != v8_extensions_.end(); |
| 730 } | 699 } |
| OLD | NEW |