Page Speed Optimization Libraries  1.4.26.1
net/instaweb/http/public/request_context.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2012 Google Inc.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *      http:///www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00018 
00019 #ifndef NET_INSTAWEB_HTTP_PUBLIC_REQUEST_CONTEXT_H_
00020 #define NET_INSTAWEB_HTTP_PUBLIC_REQUEST_CONTEXT_H_
00021 
00022 #include "net/instaweb/util/public/basictypes.h"
00023 #include "net/instaweb/util/public/ref_counted_ptr.h"
00024 #include "net/instaweb/util/public/scoped_ptr.h"
00025 #include "net/instaweb/util/public/string_util.h"
00026 
00027 namespace net_instaweb {
00028 
00029 class AbstractMutex;
00030 class LogRecord;
00031 class RequestContext;
00032 class RequestTrace;
00033 class ThreadSystem;
00034 
00035 typedef RefCountedPtr<RequestContext> RequestContextPtr;
00036 
00044 class RequestContext : public RefCounted<RequestContext> {
00045  public:
00049   explicit RequestContext(AbstractMutex* logging_mutex);
00050 
00053   static RequestContextPtr NewTestRequestContext(ThreadSystem* thread_system);
00054 
00058   virtual LogRecord* NewSubordinateLogRecord(AbstractMutex* logging_mutex);
00059 
00064   RequestTrace* root_trace_context() { return root_trace_context_.get(); }
00066   void set_root_trace_context(RequestTrace* x);
00067 
00078   virtual RequestTrace* CreateDependentTraceContext(const StringPiece& label) {
00079     return NULL;
00080   }
00081 
00093   virtual void ReleaseDependentTraceContext(RequestTrace* t);
00094 
00096   LogRecord* log_record();
00097 
00099   bool using_spdy() const { return using_spdy_; }
00100   void set_using_spdy(bool x) { using_spdy_ = x; }
00101 
00102  protected:
00105   RequestContext();
00106 
00109   void set_log_record(LogRecord* l);
00110 
00112   virtual ~RequestContext();
00113   REFCOUNT_FRIEND_DECLARATION(RequestContext);
00114 
00115  private:
00117   scoped_ptr<LogRecord> log_record_;
00118 
00120   scoped_ptr<RequestTrace> root_trace_context_;
00121 
00122   bool using_spdy_;
00123 
00124   DISALLOW_COPY_AND_ASSIGN(RequestContext);
00125 };
00126 
00127 }  
00128 
00129 #endif  ///< NET_INSTAWEB_HTTP_PUBLIC_REQUEST_CONTEXT_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines