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