| 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/browser/renderer_host/render_widget_host_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <tuple> | 10 #include <tuple> |
| (...skipping 2622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2633 RenderProcessHost* rph = GetProcess(); | 2633 RenderProcessHost* rph = GetProcess(); |
| 2634 for (std::vector<IPC::Message>::const_iterator i = messages.begin(); | 2634 for (std::vector<IPC::Message>::const_iterator i = messages.begin(); |
| 2635 i != messages.end(); ++i) { | 2635 i != messages.end(); ++i) { |
| 2636 rph->OnMessageReceived(*i); | 2636 rph->OnMessageReceived(*i); |
| 2637 if (i->dispatch_error()) | 2637 if (i->dispatch_error()) |
| 2638 rph->OnBadMessageReceived(*i); | 2638 rph->OnBadMessageReceived(*i); |
| 2639 } | 2639 } |
| 2640 } | 2640 } |
| 2641 | 2641 |
| 2642 #if defined(OS_MACOSX) | 2642 #if defined(OS_MACOSX) |
| 2643 device::mojom::WakeLockService* RenderWidgetHostImpl::GetWakeLockService() { | 2643 device::mojom::WakeLock* RenderWidgetHostImpl::GetWakeLockService() { |
| 2644 // Here is a lazy binding, and will not reconnect after connection error. | 2644 // Here is a lazy binding, and will not reconnect after connection error. |
| 2645 if (!wake_lock_) { | 2645 if (!wake_lock_) { |
| 2646 device::mojom::WakeLockServiceRequest request = | 2646 device::mojom::WakeLockRequest request = mojo::MakeRequest(&wake_lock_); |
| 2647 mojo::MakeRequest(&wake_lock_); | |
| 2648 // In some testing contexts, the service manager connection isn't | 2647 // In some testing contexts, the service manager connection isn't |
| 2649 // initialized. | 2648 // initialized. |
| 2650 if (ServiceManagerConnection::GetForProcess()) { | 2649 if (ServiceManagerConnection::GetForProcess()) { |
| 2651 service_manager::Connector* connector = | 2650 service_manager::Connector* connector = |
| 2652 ServiceManagerConnection::GetForProcess()->GetConnector(); | 2651 ServiceManagerConnection::GetForProcess()->GetConnector(); |
| 2653 DCHECK(connector); | 2652 DCHECK(connector); |
| 2654 device::mojom::WakeLockProviderPtr wake_lock_provider; | 2653 device::mojom::WakeLockProviderPtr wake_lock_provider; |
| 2655 connector->BindInterface(device::mojom::kServiceName, | 2654 connector->BindInterface(device::mojom::kServiceName, |
| 2656 mojo::MakeRequest(&wake_lock_provider)); | 2655 mojo::MakeRequest(&wake_lock_provider)); |
| 2657 wake_lock_provider->GetWakeLockWithoutContext( | 2656 wake_lock_provider->GetWakeLockWithoutContext( |
| 2658 device::mojom::WakeLockType::PreventDisplaySleep, | 2657 device::mojom::WakeLockType::PreventDisplaySleep, |
| 2659 device::mojom::WakeLockReason::ReasonOther, "GetSnapshot", | 2658 device::mojom::WakeLockReason::ReasonOther, "GetSnapshot", |
| 2660 std::move(request)); | 2659 std::move(request)); |
| 2661 } | 2660 } |
| 2662 } | 2661 } |
| 2663 return wake_lock_.get(); | 2662 return wake_lock_.get(); |
| 2664 } | 2663 } |
| 2665 #endif | 2664 #endif |
| 2666 | 2665 |
| 2667 } // namespace content | 2666 } // namespace content |
| OLD | NEW |