diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-30 18:49:42 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-30 18:49:42 +0000 |
commit | 90946cf282c6a6c6b9a5dae471201fb8869cb8e2 (patch) | |
tree | 2a2aac5d6d22e64db54d3cbb731028132d29d8a0 | |
parent | 384853b1969a9dcb0ada5131b9f703f9ed30c1c2 (diff) | |
download | chromium_src-90946cf282c6a6c6b9a5dae471201fb8869cb8e2.zip chromium_src-90946cf282c6a6c6b9a5dae471201fb8869cb8e2.tar.gz chromium_src-90946cf282c6a6c6b9a5dae471201fb8869cb8e2.tar.bz2 |
net: Add namespace net to GZip* classes.
BUG=64263
TEST=compiled locally and trybots
Review URL: http://codereview.chromium.org/6260029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73112 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | net/base/filter.cc | 5 | ||||
-rw-r--r-- | net/base/gzip_filter.cc | 5 | ||||
-rw-r--r-- | net/base/gzip_filter.h | 14 | ||||
-rw-r--r-- | net/base/gzip_header.cc | 27 | ||||
-rw-r--r-- | net/base/gzip_header.h | 25 |
5 files changed, 46 insertions, 30 deletions
diff --git a/net/base/filter.cc b/net/base/filter.cc index 309eab3..c823aa7 100644 --- a/net/base/filter.cc +++ b/net/base/filter.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -332,7 +332,8 @@ Filter* Filter::PrependNewFilter(FilterType type_id, case FILTER_TYPE_GZIP_HELPING_SDCH: case FILTER_TYPE_DEFLATE: case FILTER_TYPE_GZIP: { - scoped_ptr<GZipFilter> gz_filter(new GZipFilter(filter_context)); + scoped_ptr<net::GZipFilter> gz_filter( + new net::GZipFilter(filter_context)); if (gz_filter->InitBuffer()) { if (gz_filter->InitDecoding(type_id)) { first_filter = gz_filter.release(); diff --git a/net/base/gzip_filter.cc b/net/base/gzip_filter.cc index f1920da..7248f2d 100644 --- a/net/base/gzip_filter.cc +++ b/net/base/gzip_filter.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -22,6 +22,7 @@ #include "base/logging.h" #include "net/base/gzip_header.h" +namespace net { GZipFilter::GZipFilter(const FilterContext& filter_context) : Filter(filter_context), @@ -308,3 +309,5 @@ void GZipFilter::SkipGZipFooter() { next_stream_data_ = NULL; } } + +} // namespace net diff --git a/net/base/gzip_filter.h b/net/base/gzip_filter.h index afdc970..b37a5b1 100644 --- a/net/base/gzip_filter.h +++ b/net/base/gzip_filter.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -12,16 +12,20 @@ // GZipFilter is a subclass of Filter. See the latter's header file filter.h // for sample usage. -#ifndef NET_BASE_GZIP_FILTER_H__ -#define NET_BASE_GZIP_FILTER_H__ +#ifndef NET_BASE_GZIP_FILTER_H_ +#define NET_BASE_GZIP_FILTER_H_ #pragma once +#include "base/basictypes.h" #include "base/scoped_ptr.h" #include "net/base/filter.h" -class GZipHeader; typedef struct z_stream_s z_stream; +namespace net { + +class GZipHeader; + class GZipFilter : public Filter { public: explicit GZipFilter(const FilterContext& filter_context); @@ -140,4 +144,6 @@ class GZipFilter : public Filter { DISALLOW_COPY_AND_ASSIGN(GZipFilter); }; +} // namespace net + #endif // NET_BASE_GZIP_FILTER_H__ diff --git a/net/base/gzip_header.cc b/net/base/gzip_header.cc index 5b10a71..23a3dd3 100644 --- a/net/base/gzip_header.cc +++ b/net/base/gzip_header.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -12,17 +12,22 @@ #include "base/logging.h" +namespace net { + const uint8 GZipHeader::magic[] = { 0x1f, 0x8b }; -// ---------------------------------------------------------------------- -// GZipHeader::ReadMore() -// Attempt to parse the beginning of the given buffer as a gzip -// header. If these bytes do not constitute a complete gzip header, -// return INCOMPLETE_HEADER. If these bytes do not constitute a -// *valid* gzip header, return INVALID_HEADER. If we find a -// complete header, return COMPLETE_HEADER and set the pointer -// pointed to by header_end to the first byte beyond the gzip header. -// ---------------------------------------------------------------------- +GZipHeader::GZipHeader() { + Reset(); +} + +GZipHeader::~GZipHeader() { +} + +void GZipHeader::Reset() { + state_ = IN_HEADER_ID1; + flags_ = 0; + extra_length_ = 0; +} GZipHeader::Status GZipHeader::ReadMore(const char* inbuf, int inbuf_len, const char** header_end) { @@ -175,3 +180,5 @@ GZipHeader::Status GZipHeader::ReadMore(const char* inbuf, int inbuf_len, return INCOMPLETE_HEADER; } } + +} // namespace net diff --git a/net/base/gzip_header.h b/net/base/gzip_header.h index c245de2..85c284a 100644 --- a/net/base/gzip_header.h +++ b/net/base/gzip_header.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -18,6 +18,8 @@ #include "base/basictypes.h" +namespace net { + class GZipHeader { public: enum Status { @@ -26,19 +28,11 @@ class GZipHeader { INVALID_HEADER, // found something invalid in the header }; - GZipHeader() { - Reset(); - } - - ~GZipHeader() { - } + GZipHeader(); + ~GZipHeader(); // Wipe the slate clean and start from scratch. - void Reset() { - state_ = IN_HEADER_ID1; - flags_ = 0; - extra_length_ = 0; - } + void Reset(); // Attempt to parse the given buffer as the next installment of // bytes from a gzip header. If the bytes we've seen so far do not @@ -47,7 +41,8 @@ class GZipHeader { // gzip header, return INVALID_HEADER. When we've seen a complete // gzip header, return COMPLETE_HEADER and set the pointer pointed // to by header_end to the first byte beyond the gzip header. - Status ReadMore(const char* inbuf, int inbuf_len, + Status ReadMore(const char* inbuf, + int inbuf_len, const char** header_end); private: enum { // flags (see RFC) @@ -91,6 +86,10 @@ class GZipHeader { int state_; // our current State in the parsing FSM: an int so we can ++ uint8 flags_; // the flags byte of the header ("FLG" in the RFC) uint16 extra_length_; // how much of the "extra field" we have yet to read + + DISALLOW_COPY_AND_ASSIGN(GZipHeader); }; +} // namespace net + #endif // NET_BASE_GZIP_HEADER_H_ |