| 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(new ViewHostMsg_RecordMsg(bug_id, msg)); |
| 198 } |
| 199 |
| 200 bool GetMessages(int bug_id, std::vector<std::string>* msgs) { |
| 201 RenderThreadImpl::current()->Send(new ViewHostMsg_GetMessages(bug_id, msgs)); |
| 202 return !msgs->empty(); |
| 203 } |
| 204 |
| 195 } // namespace | 205 } // namespace |
| 196 | 206 |
| 197 class RenderThreadImpl::GpuVDAContextLostCallback | 207 class RenderThreadImpl::GpuVDAContextLostCallback |
| 198 : public WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback { | 208 : public WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback { |
| 199 public: | 209 public: |
| 200 GpuVDAContextLostCallback() {} | 210 GpuVDAContextLostCallback() {} |
| 201 virtual ~GpuVDAContextLostCallback() {} | 211 virtual ~GpuVDAContextLostCallback() {} |
| 202 virtual void onContextLost() { | 212 virtual void onContextLost() { |
| 203 ChildThread::current()->message_loop()->PostTask(FROM_HERE, base::Bind( | 213 ChildThread::current()->message_loop()->PostTask(FROM_HERE, base::Bind( |
| 204 &RenderThreadImpl::OnGpuVDAContextLoss)); | 214 &RenderThreadImpl::OnGpuVDAContextLoss)); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 v8::V8::SetCreateHistogramFunction(CreateHistogram); | 276 v8::V8::SetCreateHistogramFunction(CreateHistogram); |
| 267 v8::V8::SetAddHistogramSampleFunction(AddHistogramSample); | 277 v8::V8::SetAddHistogramSampleFunction(AddHistogramSample); |
| 268 | 278 |
| 269 #if defined(OS_MACOSX) || defined(OS_ANDROID) | 279 #if defined(OS_MACOSX) || defined(OS_ANDROID) |
| 270 // On Mac and Android, the select popups are rendered by the browser. | 280 // On Mac and Android, the select popups are rendered by the browser. |
| 271 WebKit::WebView::setUseExternalPopupMenus(true); | 281 WebKit::WebView::setUseExternalPopupMenus(true); |
| 272 #endif | 282 #endif |
| 273 | 283 |
| 274 lazy_tls.Pointer()->Set(this); | 284 lazy_tls.Pointer()->Set(this); |
| 275 | 285 |
| 286 content::debug::RegisterMessageHandlers(RecordMsg, GetMessages); |
| 287 |
| 276 #if defined(OS_WIN) | 288 #if defined(OS_WIN) |
| 277 // If you are running plugins in this thread you need COM active but in | 289 // If you are running plugins in this thread you need COM active but in |
| 278 // the normal case you don't. | 290 // the normal case you don't. |
| 279 if (RenderProcessImpl::InProcessPlugins()) | 291 if (RenderProcessImpl::InProcessPlugins()) |
| 280 initialize_com_.reset(new base::win::ScopedCOMInitializer()); | 292 initialize_com_.reset(new base::win::ScopedCOMInitializer()); |
| 281 #endif | 293 #endif |
| 282 | 294 |
| 283 // Register this object as the main thread. | 295 // Register this object as the main thread. |
| 284 ChildProcess::current()->set_main_thread(this); | 296 ChildProcess::current()->set_main_thread(this); |
| 285 | 297 |
| (...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 | 1141 |
| 1130 scoped_refptr<base::MessageLoopProxy> | 1142 scoped_refptr<base::MessageLoopProxy> |
| 1131 RenderThreadImpl::GetFileThreadMessageLoopProxy() { | 1143 RenderThreadImpl::GetFileThreadMessageLoopProxy() { |
| 1132 DCHECK(message_loop() == MessageLoop::current()); | 1144 DCHECK(message_loop() == MessageLoop::current()); |
| 1133 if (!file_thread_.get()) { | 1145 if (!file_thread_.get()) { |
| 1134 file_thread_.reset(new base::Thread("Renderer::FILE")); | 1146 file_thread_.reset(new base::Thread("Renderer::FILE")); |
| 1135 file_thread_->Start(); | 1147 file_thread_->Start(); |
| 1136 } | 1148 } |
| 1137 return file_thread_->message_loop_proxy(); | 1149 return file_thread_->message_loop_proxy(); |
| 1138 } | 1150 } |
| OLD | NEW |