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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 | 395 |
396 AddFilter((new IndexedDBMessageFilter(thread_safe_sender()))->GetFilter()); | 396 AddFilter((new IndexedDBMessageFilter(thread_safe_sender()))->GetFilter()); |
397 | 397 |
398 AddFilter((new EmbeddedWorkerContextMessageFilter())->GetFilter()); | 398 AddFilter((new EmbeddedWorkerContextMessageFilter())->GetFilter()); |
399 | 399 |
400 #if defined(USE_MOJO) | 400 #if defined(USE_MOJO) |
401 // MojoRenderProcessObserver deletes itself as necessary. | 401 // MojoRenderProcessObserver deletes itself as necessary. |
402 new MojoRenderProcessObserver(this); | 402 new MojoRenderProcessObserver(this); |
403 #endif | 403 #endif |
404 | 404 |
| 405 gamepad_shared_memory_reader_ = |
| 406 new GamepadSharedMemoryReader(GetIOMessageLoopProxy()); |
| 407 AddFilter(gamepad_shared_memory_reader_.get()); |
| 408 |
405 GetContentClient()->renderer()->RenderThreadStarted(); | 409 GetContentClient()->renderer()->RenderThreadStarted(); |
406 | 410 |
407 InitSkiaEventTracer(); | 411 InitSkiaEventTracer(); |
408 | 412 |
409 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 413 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
410 if (command_line.HasSwitch(cc::switches::kEnableGpuBenchmarking)) | 414 if (command_line.HasSwitch(cc::switches::kEnableGpuBenchmarking)) |
411 RegisterExtension(GpuBenchmarkingExtension::Get()); | 415 RegisterExtension(GpuBenchmarkingExtension::Get()); |
412 | 416 |
413 is_impl_side_painting_enabled_ = | 417 is_impl_side_painting_enabled_ = |
414 command_line.HasSwitch(switches::kEnableImplSidePainting) && | 418 command_line.HasSwitch(switches::kEnableImplSidePainting) && |
(...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1481 | 1485 |
1482 void RenderThreadImpl::SetFlingCurveParameters( | 1486 void RenderThreadImpl::SetFlingCurveParameters( |
1483 const std::vector<float>& new_touchpad, | 1487 const std::vector<float>& new_touchpad, |
1484 const std::vector<float>& new_touchscreen) { | 1488 const std::vector<float>& new_touchscreen) { |
1485 webkit_platform_support_->SetFlingCurveParameters(new_touchpad, | 1489 webkit_platform_support_->SetFlingCurveParameters(new_touchpad, |
1486 new_touchscreen); | 1490 new_touchscreen); |
1487 | 1491 |
1488 } | 1492 } |
1489 | 1493 |
1490 void RenderThreadImpl::SampleGamepads(blink::WebGamepads* data) { | 1494 void RenderThreadImpl::SampleGamepads(blink::WebGamepads* data) { |
1491 if (!gamepad_shared_memory_reader_) | |
1492 gamepad_shared_memory_reader_.reset(new GamepadSharedMemoryReader); | |
1493 gamepad_shared_memory_reader_->SampleGamepads(*data); | 1495 gamepad_shared_memory_reader_->SampleGamepads(*data); |
1494 } | 1496 } |
1495 | 1497 |
| 1498 void RenderThreadImpl::SetGamepadListener(blink::WebGamepadListener* listener) { |
| 1499 gamepad_shared_memory_reader_->SetGamepadListener(listener); |
| 1500 } |
| 1501 |
1496 void RenderThreadImpl::WidgetCreated() { | 1502 void RenderThreadImpl::WidgetCreated() { |
1497 widget_count_++; | 1503 widget_count_++; |
1498 } | 1504 } |
1499 | 1505 |
1500 void RenderThreadImpl::WidgetDestroyed() { | 1506 void RenderThreadImpl::WidgetDestroyed() { |
1501 widget_count_--; | 1507 widget_count_--; |
1502 } | 1508 } |
1503 | 1509 |
1504 void RenderThreadImpl::WidgetHidden() { | 1510 void RenderThreadImpl::WidgetHidden() { |
1505 DCHECK_LT(hidden_widget_count_, widget_count_); | 1511 DCHECK_LT(hidden_widget_count_, widget_count_); |
(...skipping 16 matching lines...) Expand all Loading... |
1522 hidden_widget_count_--; | 1528 hidden_widget_count_--; |
1523 | 1529 |
1524 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { | 1530 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { |
1525 return; | 1531 return; |
1526 } | 1532 } |
1527 | 1533 |
1528 ScheduleIdleHandler(kLongIdleHandlerDelayMs); | 1534 ScheduleIdleHandler(kLongIdleHandlerDelayMs); |
1529 } | 1535 } |
1530 | 1536 |
1531 } // namespace content | 1537 } // namespace content |
OLD | NEW |