Page Speed Optimization Libraries  1.3.25.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 
00059   RequestTrace* root_trace_context() { return root_trace_context_.get(); }
00061   void set_root_trace_context(RequestTrace* x);
00062 
00073   virtual RequestTrace* CreateDependentTraceContext(const StringPiece& label) {
00074     return NULL;
00075   }
00076 
00088   virtual void ReleaseDependentTraceContext(RequestTrace* t);
00089 
00091   LogRecord* log_record();
00092 
00094   bool using_spdy() const { return using_spdy_; }
00095   void set_using_spdy(bool x) { using_spdy_ = x; }
00096 
00097  protected:
00100   RequestContext();
00101 
00104   void set_log_record(LogRecord* l);
00105 
00107   virtual ~RequestContext();
00108   REFCOUNT_FRIEND_DECLARATION(RequestContext);
00109 
00110  private:
00112   scoped_ptr<LogRecord> log_record_;
00113 
00115   scoped_ptr<RequestTrace> root_trace_context_;
00116 
00117   bool using_spdy_;
00118 
00119   DISALLOW_COPY_AND_ASSIGN(RequestContext);
00120 };
00121 
00122 }  
00123 
00124 #endif  ///< NET_INSTAWEB_HTTP_PUBLIC_REQUEST_CONTEXT_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines