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