| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CONTENT_CHILD_WEB_DISCARDABLE_MEMORY_IMPL_H_ | 5 #ifndef CONTENT_CHILD_WEB_DISCARDABLE_MEMORY_IMPL_H_ |
| 6 #define CONTENT_CHILD_WEB_DISCARDABLE_MEMORY_IMPL_H_ | 6 #define CONTENT_CHILD_WEB_DISCARDABLE_MEMORY_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/discardable_memory.h" | |
| 10 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 11 #include "third_party/WebKit/public/platform/WebDiscardableMemory.h" | 10 #include "third_party/WebKit/public/platform/WebDiscardableMemory.h" |
| 12 | 11 |
| 13 namespace blink { | 12 namespace base { |
| 14 class WebDiscardableMemory; | 13 class DiscardableMemory; |
| 15 } | 14 } |
| 16 | 15 |
| 17 namespace content { | 16 namespace content { |
| 18 | 17 |
| 19 // Implementation of WebDiscardableMemory that is responsible for allocating | 18 // Implementation of WebDiscardableMemory that is responsible for allocating |
| 20 // discardable memory. | 19 // discardable memory. |
| 21 class WebDiscardableMemoryImpl : public blink::WebDiscardableMemory { | 20 class WebDiscardableMemoryImpl : public blink::WebDiscardableMemory { |
| 22 public: | 21 public: |
| 23 virtual ~WebDiscardableMemoryImpl(); | 22 virtual ~WebDiscardableMemoryImpl(); |
| 24 | 23 |
| 25 static scoped_ptr<WebDiscardableMemoryImpl> CreateLockedMemory(size_t size); | 24 static scoped_ptr<WebDiscardableMemoryImpl> CreateLockedMemory(size_t size); |
| 26 | 25 |
| 27 // blink::WebDiscardableMemory: | 26 // blink::WebDiscardableMemory: |
| 28 virtual bool lock(); | 27 virtual bool lock(); |
| 29 virtual void unlock(); | 28 virtual void unlock(); |
| 30 virtual void* data(); | 29 virtual void* data(); |
| 31 | 30 |
| 32 private: | 31 private: |
| 33 WebDiscardableMemoryImpl(scoped_ptr<base::DiscardableMemory> memory); | 32 WebDiscardableMemoryImpl(scoped_ptr<base::DiscardableMemory> memory); |
| 34 | 33 |
| 35 scoped_ptr<base::DiscardableMemory> discardable_; | 34 scoped_ptr<base::DiscardableMemory> discardable_; |
| 36 | 35 |
| 37 DISALLOW_COPY_AND_ASSIGN(WebDiscardableMemoryImpl); | 36 DISALLOW_COPY_AND_ASSIGN(WebDiscardableMemoryImpl); |
| 38 }; | 37 }; |
| 39 | 38 |
| 40 } // namespace content | 39 } // namespace content |
| 41 | 40 |
| 42 #endif // CONTENT_CHILD_WEB_DISCARDABLE_MEMORY_IMPL_H_ | 41 #endif // CONTENT_CHILD_WEB_DISCARDABLE_MEMORY_IMPL_H_ |
| OLD | NEW |