Page Speed Optimization Libraries  1.9.32.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
system_message_handler.h
Go to the documentation of this file.
1 /*
2  * Copyright 2014 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http:///www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
18 
19 #ifndef NET_INSTAWEB_SYSTEM_PUBLIC_SYSTEM_MESSAGE_HANDLER_H_
20 #define NET_INSTAWEB_SYSTEM_PUBLIC_SYSTEM_MESSAGE_HANDLER_H_
21 
28 
29 namespace net_instaweb {
30 
31 class AbstractMutex;
32 class SharedCircularBuffer;
33 class Timer;
34 class Writer;
35 
38 class SystemMessageHandler : public GoogleMessageHandler {
39  public:
40  SystemMessageHandler(Timer* timer, AbstractMutex* mutex);
41 
42  virtual ~SystemMessageHandler();
43 
47  void set_buffer(SharedCircularBuffer* buff);
48 
49  void SetPidString(const int64 pid) {
50  pid_string_ = StrCat("[", Integer64ToString(pid), "]");
51  }
52 
54  virtual bool Dump(Writer* writer);
55 
56  protected:
58  virtual void AddMessageToBuffer(MessageType type,
59  GoogleString formatted_message);
60 
61  private:
64  Timer* timer_;
65  scoped_ptr<AbstractMutex> mutex_;
66  SharedCircularBuffer* buffer_;
71  GoogleMessageHandler internal_handler_;
72  GoogleString pid_string_;
73 
74  DISALLOW_COPY_AND_ASSIGN(SystemMessageHandler);
75 };
76 
77 }
78 
79 #endif
void set_buffer(SharedCircularBuffer *buff)
virtual bool Dump(Writer *writer)
Dump contents of SharedCircularBuffer.
Definition: system_message_handler.h:38
virtual void AddMessageToBuffer(MessageType type, GoogleString formatted_message)
Add messages to the SharedCircularBuffer.