Page Speed Optimization Libraries  1.5.27.2
net/instaweb/util/public/inprocess_shared_mem.h
Go to the documentation of this file.
00001 // Copyright 2011 Google Inc.
00016 
00017 #ifndef NET_INSTAWEB_UTIL_PUBLIC_INPROCESS_SHARED_MEM_H_
00018 #define NET_INSTAWEB_UTIL_PUBLIC_INPROCESS_SHARED_MEM_H_
00019 
00020 #include <cstddef>
00021 #include <map>
00022 
00023 #include "net/instaweb/util/public/abstract_shared_mem.h"
00024 #include "net/instaweb/util/public/basictypes.h"
00025 #include "net/instaweb/util/public/string.h"
00026 
00027 namespace net_instaweb {
00028 
00029 class MessageHandler;
00030 class ThreadSystem;
00031 
00038 class InProcessSharedMem : public AbstractSharedMem {
00039  public:
00041   explicit InProcessSharedMem(ThreadSystem* thread_system);
00042   virtual ~InProcessSharedMem();
00043 
00046   virtual size_t SharedMutexSize() const;
00047   virtual AbstractSharedMemSegment* CreateSegment(
00048       const GoogleString& name, size_t size, MessageHandler* handler);
00049   virtual AbstractSharedMemSegment* AttachToSegment(
00050       const GoogleString& name, size_t size, MessageHandler* handler);
00051   virtual void DestroySegment(const GoogleString& name,
00052                               MessageHandler* handler);
00053 
00054  private:
00055   class DelegateMutex;
00056   class DelegateSegment;
00057   class Segment;
00058   typedef std::map<GoogleString, Segment*> SegmentMap;
00059 
00060   ThreadSystem* thread_system_;
00061   SegmentMap segments_;
00062 
00063   DISALLOW_COPY_AND_ASSIGN(InProcessSharedMem);
00064 };
00065 
00066 }  
00067 
00068 #endif  ///< NET_INSTAWEB_UTIL_PUBLIC_INPROCESS_SHARED_MEM_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines