Chromium Code Reviews| Index: components/memory_coordinator/child/blink_memory_coordinator_client.cc |
| diff --git a/components/memory_coordinator/child/blink_memory_coordinator_client.cc b/components/memory_coordinator/child/blink_memory_coordinator_client.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0879e4be2ba2362c42fb3de7988e37968735dca9 |
| --- /dev/null |
| +++ b/components/memory_coordinator/child/blink_memory_coordinator_client.cc |
| @@ -0,0 +1,37 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "components/memory_coordinator/child/blink_memory_coordinator_client.h" |
| + |
| +#include "third_party/WebKit/public/platform/Platform.h" |
| +#include "third_party/WebKit/public/web/WebMemoryCoordinator.h" |
| + |
| +namespace memory_coordinator { |
| + |
| +BlinkMemoryCoordinatorClient::BlinkMemoryCoordinatorClient() {} |
| + |
| +BlinkMemoryCoordinatorClient::~BlinkMemoryCoordinatorClient() {} |
| + |
| +void BlinkMemoryCoordinatorClient::OnMemoryStateChange( |
| + mojom::MemoryState state) { |
| + if (!blink::Platform::current()) { |
| + return; |
| + } |
| + |
| + switch (state) { |
| + case mojom::MemoryState::NORMAL: |
| + blink::WebMemoryCoordinator::setAllocationMode( |
|
haraken
2016/06/27 02:17:07
As commented in the other place, I want to make th
bashi
2016/06/27 03:49:29
That requires duplicate enums in public/web which
haraken
2016/06/27 04:48:33
But you're already introducing WebMemoryAllocation
bashi
2016/06/27 06:36:46
It's not going to be the same as mojom::MemoryStat
|
| + blink::WebMemoryAllocationMode::Normal); |
| + break; |
| + case mojom::MemoryState::THROTTLED: |
| + blink::WebMemoryCoordinator::setAllocationMode( |
| + blink::WebMemoryAllocationMode::Throttled); |
| + break; |
| + case mojom::MemoryState::UNKNOWN: |
| + default: |
| + LOG(WARNING) << "Unrecognized memory state: " << state; |
| + } |
| +} |
| + |
| +} // namespace memory_coordinator |