| 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_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> |
| 11 | 11 |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/debug/trace_event.h" | 13 #include "base/debug/trace_event.h" |
| 14 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/metrics/field_trial.h" | 16 #include "base/metrics/field_trial.h" |
| 17 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
| 18 #include "base/metrics/stats_table.h" | 18 #include "base/metrics/stats_table.h" |
| 19 #include "base/process_util.h" | 19 #include "base/process_util.h" |
| 20 #include "base/shared_memory.h" | 20 #include "base/shared_memory.h" |
| 21 #include "base/task.h" | 21 #include "base/task.h" |
| 22 #include "base/threading/thread_local.h" | 22 #include "base/threading/thread_local.h" |
| 23 #include "base/values.h" | 23 #include "base/values.h" |
| 24 #include "content/common/appcache/appcache_dispatcher.h" | 24 #include "content/common/appcache/appcache_dispatcher.h" |
| 25 #include "content/common/child_process_messages.h" |
| 25 #include "content/common/database_messages.h" | 26 #include "content/common/database_messages.h" |
| 26 #include "content/common/db_message_filter.h" | 27 #include "content/common/db_message_filter.h" |
| 27 #include "content/common/dom_storage_messages.h" | 28 #include "content/common/dom_storage_messages.h" |
| 28 #include "content/common/gpu/gpu_messages.h" | 29 #include "content/common/gpu/gpu_messages.h" |
| 29 #include "content/common/npobject_util.h" | 30 #include "content/common/npobject_util.h" |
| 30 #include "content/common/plugin_messages.h" | 31 #include "content/common/plugin_messages.h" |
| 31 #include "content/common/renderer_preferences.h" | 32 #include "content/common/renderer_preferences.h" |
| 32 #include "content/common/resource_dispatcher.h" | 33 #include "content/common/resource_dispatcher.h" |
| 33 #include "content/common/resource_messages.h" | 34 #include "content/common/resource_messages.h" |
| 34 #include "content/common/view_messages.h" | 35 #include "content/common/view_messages.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptController.h
" | 67 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptController.h
" |
| 67 #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageEventDispat
cher.h" | 68 #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageEventDispat
cher.h" |
| 68 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 69 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
| 69 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 70 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 70 #include "ui/base/ui_base_switches.h" | 71 #include "ui/base/ui_base_switches.h" |
| 71 #include "v8/include/v8.h" | 72 #include "v8/include/v8.h" |
| 72 #include "webkit/extensions/v8/playback_extension.h" | 73 #include "webkit/extensions/v8/playback_extension.h" |
| 73 #include "webkit/glue/webkit_glue.h" | 74 #include "webkit/glue/webkit_glue.h" |
| 74 | 75 |
| 75 // TODO(port) | 76 // TODO(port) |
| 76 #if defined(OS_WIN) | 77 #if !defined(OS_WIN) |
| 77 #include "content/common/child_process_messages.h" | |
| 78 #else | |
| 79 #include "base/memory/scoped_handle.h" | 78 #include "base/memory/scoped_handle.h" |
| 80 #include "content/common/np_channel_base.h" | 79 #include "content/common/np_channel_base.h" |
| 81 #endif | 80 #endif |
| 82 | 81 |
| 83 #if defined(OS_WIN) | 82 #if defined(OS_WIN) |
| 84 #include <windows.h> | 83 #include <windows.h> |
| 85 #include <objbase.h> | 84 #include <objbase.h> |
| 86 #endif | 85 #endif |
| 87 | 86 |
| 88 #if defined(OS_POSIX) | 87 #if defined(OS_POSIX) |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 WebRuntimeFeatures::enableQuota(true); | 515 WebRuntimeFeatures::enableQuota(true); |
| 517 | 516 |
| 518 FOR_EACH_OBSERVER(RenderProcessObserver, observers_, WebKitInitialized()); | 517 FOR_EACH_OBSERVER(RenderProcessObserver, observers_, WebKitInitialized()); |
| 519 } | 518 } |
| 520 | 519 |
| 521 void RenderThreadImpl::RecordUserMetrics(const std::string& action) { | 520 void RenderThreadImpl::RecordUserMetrics(const std::string& action) { |
| 522 Send(new ViewHostMsg_UserMetricsRecordAction(action)); | 521 Send(new ViewHostMsg_UserMetricsRecordAction(action)); |
| 523 } | 522 } |
| 524 | 523 |
| 525 base::SharedMemoryHandle RenderThreadImpl::HostAllocateSharedMemoryBuffer( | 524 base::SharedMemoryHandle RenderThreadImpl::HostAllocateSharedMemoryBuffer( |
| 526 uint32 buffer_size) { | 525 uint32 buffer_size) { |
| 527 base::SharedMemoryHandle mem_handle; | 526 base::SharedMemoryHandle mem_handle; |
| 528 Send(new ViewHostMsg_AllocateSharedMemoryBuffer(buffer_size, &mem_handle)); | 527 Send(new ChildProcessHostMsg_SyncAllocateSharedMemory( |
| 528 buffer_size, &mem_handle)); |
| 529 return mem_handle; | 529 return mem_handle; |
| 530 } | 530 } |
| 531 | 531 |
| 532 void RenderThreadImpl::RegisterExtension(v8::Extension* extension) { | 532 void RenderThreadImpl::RegisterExtension(v8::Extension* extension) { |
| 533 WebScriptController::registerExtension(extension); | 533 WebScriptController::registerExtension(extension); |
| 534 v8_extensions_.insert(extension->name()); | 534 v8_extensions_.insert(extension->name()); |
| 535 } | 535 } |
| 536 | 536 |
| 537 bool RenderThreadImpl::IsRegisteredExtension( | 537 bool RenderThreadImpl::IsRegisteredExtension( |
| 538 const std::string& v8_extension_name) const { | 538 const std::string& v8_extension_name) const { |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 | 766 |
| 767 scoped_refptr<base::MessageLoopProxy> | 767 scoped_refptr<base::MessageLoopProxy> |
| 768 RenderThreadImpl::GetFileThreadMessageLoopProxy() { | 768 RenderThreadImpl::GetFileThreadMessageLoopProxy() { |
| 769 DCHECK(message_loop() == MessageLoop::current()); | 769 DCHECK(message_loop() == MessageLoop::current()); |
| 770 if (!file_thread_.get()) { | 770 if (!file_thread_.get()) { |
| 771 file_thread_.reset(new base::Thread("Renderer::FILE")); | 771 file_thread_.reset(new base::Thread("Renderer::FILE")); |
| 772 file_thread_->Start(); | 772 file_thread_->Start(); |
| 773 } | 773 } |
| 774 return file_thread_->message_loop_proxy(); | 774 return file_thread_->message_loop_proxy(); |
| 775 } | 775 } |
| OLD | NEW |