| 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 24 matching lines...) Expand all Loading... |
| 35 #include "content/common/indexed_db/indexed_db_dispatcher.h" | 35 #include "content/common/indexed_db/indexed_db_dispatcher.h" |
| 36 #include "content/common/indexed_db/indexed_db_message_filter.h" | 36 #include "content/common/indexed_db/indexed_db_message_filter.h" |
| 37 #include "content/common/npobject_util.h" | 37 #include "content/common/npobject_util.h" |
| 38 #include "content/common/plugin_messages.h" | 38 #include "content/common/plugin_messages.h" |
| 39 #include "content/common/resource_dispatcher.h" | 39 #include "content/common/resource_dispatcher.h" |
| 40 #include "content/common/resource_messages.h" | 40 #include "content/common/resource_messages.h" |
| 41 #include "content/common/view_messages.h" | 41 #include "content/common/view_messages.h" |
| 42 #include "content/common/web_database_observer_impl.h" | 42 #include "content/common/web_database_observer_impl.h" |
| 43 #include "content/public/common/compositor_util.h" | 43 #include "content/public/common/compositor_util.h" |
| 44 #include "content/public/common/content_constants.h" | 44 #include "content/public/common/content_constants.h" |
| 45 #include "content/public/common/content_debug_logging.h" | |
| 46 #include "content/public/common/content_paths.h" | 45 #include "content/public/common/content_paths.h" |
| 47 #include "content/public/common/content_switches.h" | 46 #include "content/public/common/content_switches.h" |
| 48 #include "content/public/common/renderer_preferences.h" | 47 #include "content/public/common/renderer_preferences.h" |
| 49 #include "content/public/common/url_constants.h" | 48 #include "content/public/common/url_constants.h" |
| 50 #include "content/public/renderer/content_renderer_client.h" | 49 #include "content/public/renderer/content_renderer_client.h" |
| 51 #include "content/public/renderer/render_process_observer.h" | 50 #include "content/public/renderer/render_process_observer.h" |
| 52 #include "content/public/renderer/render_view_visitor.h" | 51 #include "content/public/renderer/render_view_visitor.h" |
| 53 #include "content/renderer/browser_plugin/old/browser_plugin_channel_manager.h" | 52 #include "content/renderer/browser_plugin/old/browser_plugin_channel_manager.h" |
| 54 #include "content/renderer/browser_plugin/old/browser_plugin_registry.h" | 53 #include "content/renderer/browser_plugin/old/browser_plugin_registry.h" |
| 55 #include "content/renderer/devtools_agent_filter.h" | 54 #include "content/renderer/devtools_agent_filter.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 histogram_name, min, max, buckets, | 185 histogram_name, min, max, buckets, |
| 187 base::Histogram::kUmaTargetedHistogramFlag); | 186 base::Histogram::kUmaTargetedHistogramFlag); |
| 188 return histogram; | 187 return histogram; |
| 189 } | 188 } |
| 190 | 189 |
| 191 void AddHistogramSample(void* hist, int sample) { | 190 void AddHistogramSample(void* hist, int sample) { |
| 192 base::Histogram* histogram = static_cast<base::Histogram*>(hist); | 191 base::Histogram* histogram = static_cast<base::Histogram*>(hist); |
| 193 histogram->Add(sample); | 192 histogram->Add(sample); |
| 194 } | 193 } |
| 195 | 194 |
| 196 void RecordMsg(int bug_id, const std::string& msg) { | |
| 197 RenderThreadImpl::current()->Send( | |
| 198 new ViewHostMsg_ContentDebugRecordMsg(bug_id, msg)); | |
| 199 } | |
| 200 | |
| 201 bool GetMessages(int bug_id, std::vector<std::string>* msgs) { | |
| 202 bool handled = false; | |
| 203 RenderThreadImpl::current()->Send( | |
| 204 new ViewHostMsg_ContentDebugGetMessages(bug_id, &handled, msgs)); | |
| 205 return handled; | |
| 206 } | |
| 207 | |
| 208 } // namespace | 195 } // namespace |
| 209 | 196 |
| 210 class RenderThreadImpl::GpuVDAContextLostCallback | 197 class RenderThreadImpl::GpuVDAContextLostCallback |
| 211 : public WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback { | 198 : public WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback { |
| 212 public: | 199 public: |
| 213 GpuVDAContextLostCallback() {} | 200 GpuVDAContextLostCallback() {} |
| 214 virtual ~GpuVDAContextLostCallback() {} | 201 virtual ~GpuVDAContextLostCallback() {} |
| 215 virtual void onContextLost() { | 202 virtual void onContextLost() { |
| 216 ChildThread::current()->message_loop()->PostTask(FROM_HERE, base::Bind( | 203 ChildThread::current()->message_loop()->PostTask(FROM_HERE, base::Bind( |
| 217 &RenderThreadImpl::OnGpuVDAContextLoss)); | 204 &RenderThreadImpl::OnGpuVDAContextLoss)); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 v8::V8::SetCreateHistogramFunction(CreateHistogram); | 266 v8::V8::SetCreateHistogramFunction(CreateHistogram); |
| 280 v8::V8::SetAddHistogramSampleFunction(AddHistogramSample); | 267 v8::V8::SetAddHistogramSampleFunction(AddHistogramSample); |
| 281 | 268 |
| 282 #if defined(OS_MACOSX) || defined(OS_ANDROID) | 269 #if defined(OS_MACOSX) || defined(OS_ANDROID) |
| 283 // On Mac and Android, the select popups are rendered by the browser. | 270 // On Mac and Android, the select popups are rendered by the browser. |
| 284 WebKit::WebView::setUseExternalPopupMenus(true); | 271 WebKit::WebView::setUseExternalPopupMenus(true); |
| 285 #endif | 272 #endif |
| 286 | 273 |
| 287 lazy_tls.Pointer()->Set(this); | 274 lazy_tls.Pointer()->Set(this); |
| 288 | 275 |
| 289 content::debug::RegisterMessageHandlers(RecordMsg, GetMessages); | |
| 290 | |
| 291 #if defined(OS_WIN) | 276 #if defined(OS_WIN) |
| 292 // If you are running plugins in this thread you need COM active but in | 277 // If you are running plugins in this thread you need COM active but in |
| 293 // the normal case you don't. | 278 // the normal case you don't. |
| 294 if (RenderProcessImpl::InProcessPlugins()) | 279 if (RenderProcessImpl::InProcessPlugins()) |
| 295 initialize_com_.reset(new base::win::ScopedCOMInitializer()); | 280 initialize_com_.reset(new base::win::ScopedCOMInitializer()); |
| 296 #endif | 281 #endif |
| 297 | 282 |
| 298 // Register this object as the main thread. | 283 // Register this object as the main thread. |
| 299 ChildProcess::current()->set_main_thread(this); | 284 ChildProcess::current()->set_main_thread(this); |
| 300 | 285 |
| (...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1142 | 1127 |
| 1143 scoped_refptr<base::MessageLoopProxy> | 1128 scoped_refptr<base::MessageLoopProxy> |
| 1144 RenderThreadImpl::GetFileThreadMessageLoopProxy() { | 1129 RenderThreadImpl::GetFileThreadMessageLoopProxy() { |
| 1145 DCHECK(message_loop() == MessageLoop::current()); | 1130 DCHECK(message_loop() == MessageLoop::current()); |
| 1146 if (!file_thread_.get()) { | 1131 if (!file_thread_.get()) { |
| 1147 file_thread_.reset(new base::Thread("Renderer::FILE")); | 1132 file_thread_.reset(new base::Thread("Renderer::FILE")); |
| 1148 file_thread_->Start(); | 1133 file_thread_->Start(); |
| 1149 } | 1134 } |
| 1150 return file_thread_->message_loop_proxy(); | 1135 return file_thread_->message_loop_proxy(); |
| 1151 } | 1136 } |
| OLD | NEW |