diff options
author | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-07 15:26:05 +0000 |
---|---|---|
committer | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-07 15:26:05 +0000 |
commit | 2770c95a50db703c322d65d286aa5771e58ac25a (patch) | |
tree | 595b2adf92be75f65eccbbb0760e3969d2d840c3 /webkit/glue | |
parent | eac3ba4f0f315bb2c68289062cb9f4f5ec632f90 (diff) | |
download | chromium_src-2770c95a50db703c322d65d286aa5771e58ac25a.zip chromium_src-2770c95a50db703c322d65d286aa5771e58ac25a.tar.gz chromium_src-2770c95a50db703c322d65d286aa5771e58ac25a.tar.bz2 |
Cleaning up src/media to be consistent with static versus anonymous namespaces.
We were using a mix of both (and sometimes even static functions *inside* anonymous namespaces!) so we decided to stick to using static.
Also moved static/test code into media namespace and removed media:: prefixes.
BUG=none
TEST=compiles
Review URL: http://codereview.chromium.org/6628020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77135 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r-- | webkit/glue/media/buffered_data_source.cc | 14 | ||||
-rw-r--r-- | webkit/glue/media/buffered_data_source_unittest.cc | 15 | ||||
-rw-r--r-- | webkit/glue/media/buffered_resource_loader.cc | 20 | ||||
-rw-r--r-- | webkit/glue/media/buffered_resource_loader_unittest.cc | 24 | ||||
-rw-r--r-- | webkit/glue/media/simple_data_source.cc | 10 | ||||
-rw-r--r-- | webkit/glue/media/simple_data_source_unittest.cc | 28 |
6 files changed, 43 insertions, 68 deletions
diff --git a/webkit/glue/media/buffered_data_source.cc b/webkit/glue/media/buffered_data_source.cc index 913d400..7902221 100644 --- a/webkit/glue/media/buffered_data_source.cc +++ b/webkit/glue/media/buffered_data_source.cc @@ -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. @@ -10,26 +10,22 @@ using WebKit::WebFrame; -namespace { +namespace webkit_glue { // Defines how long we should wait for more data before we declare a connection // timeout and start a new request. // TODO(hclam): Set it to 5s, calibrate this value later. -const int kTimeoutMilliseconds = 5000; +static const int kTimeoutMilliseconds = 5000; // Defines how many times we should try to read from a buffered resource loader // before we declare a read error. After each failure of read from a buffered // resource loader, a new one is created to be read. -const int kReadTrials = 3; +static const int kReadTrials = 3; // BufferedDataSource has an intermediate buffer, this value governs the initial // size of that buffer. It is set to 32KB because this is a typical read size // of FFmpeg. -const int kInitialReadBufferSize = 32768; - -} // namespace - -namespace webkit_glue { +static const int kInitialReadBufferSize = 32768; BufferedDataSource::BufferedDataSource( MessageLoop* render_loop, diff --git a/webkit/glue/media/buffered_data_source_unittest.cc b/webkit/glue/media/buffered_data_source_unittest.cc index f370803..41f37d6 100644 --- a/webkit/glue/media/buffered_data_source_unittest.cc +++ b/webkit/glue/media/buffered_data_source_unittest.cc @@ -30,11 +30,11 @@ using ::testing::StrictMock; using ::testing::NiceMock; using ::testing::WithArgs; -namespace { +namespace webkit_glue { -const char* kHttpUrl = "http://test"; -const char* kFileUrl = "file://test"; -const int kDataSize = 1024; +static const char* kHttpUrl = "http://test"; +static const char* kFileUrl = "file://test"; +static const int kDataSize = 1024; enum NetworkState { NONE, @@ -42,16 +42,11 @@ enum NetworkState { LOADING }; -} // namespace - -namespace webkit_glue { - // A mock BufferedDataSource to inject mock BufferedResourceLoader through // CreateResourceLoader() method. class MockBufferedDataSource : public BufferedDataSource { public: - MockBufferedDataSource( - MessageLoop* message_loop, WebFrame* frame) + MockBufferedDataSource(MessageLoop* message_loop, WebFrame* frame) : BufferedDataSource(message_loop, frame) { } diff --git a/webkit/glue/media/buffered_resource_loader.cc b/webkit/glue/media/buffered_resource_loader.cc index 0570075..4a3ae8b 100644 --- a/webkit/glue/media/buffered_resource_loader.cc +++ b/webkit/glue/media/buffered_resource_loader.cc @@ -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. @@ -22,19 +22,19 @@ using WebKit::WebURLRequest; using WebKit::WebURLResponse; using webkit_glue::MultipartResponseDelegate; -namespace { +namespace webkit_glue { -const int kHttpOK = 200; -const int kHttpPartialContent = 206; +static const int kHttpOK = 200; +static const int kHttpPartialContent = 206; // Define the number of bytes in a megabyte. -const size_t kMegabyte = 1024 * 1024; +static const size_t kMegabyte = 1024 * 1024; // Backward capacity of the buffer, by default 2MB. -const size_t kBackwardCapcity = 2 * kMegabyte; +static const size_t kBackwardCapcity = 2 * kMegabyte; // Forward capacity of the buffer, by default 10MB. -const size_t kForwardCapacity = 10 * kMegabyte; +static const size_t kForwardCapacity = 10 * kMegabyte; // The threshold of bytes that we should wait until the data arrives in the // future instead of restarting a new connection. This number is defined in the @@ -42,11 +42,7 @@ const size_t kForwardCapacity = 10 * kMegabyte; // and amount of time for a suitable wait. Now I just make a guess for this // number to be 2MB. // TODO(hclam): determine a better value for this. -const int kForwardWaitThreshold = 2 * kMegabyte; - -} // namespace - -namespace webkit_glue { +static const int kForwardWaitThreshold = 2 * kMegabyte; BufferedResourceLoader::BufferedResourceLoader( const GURL& url, diff --git a/webkit/glue/media/buffered_resource_loader_unittest.cc b/webkit/glue/media/buffered_resource_loader_unittest.cc index 4e0dfef..aef44ca 100644 --- a/webkit/glue/media/buffered_resource_loader_unittest.cc +++ b/webkit/glue/media/buffered_resource_loader_unittest.cc @@ -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. @@ -38,17 +38,17 @@ using WebKit::WebFrameClient; using WebKit::WebURLResponse; using WebKit::WebView; -namespace { +namespace webkit_glue { -const char* kHttpUrl = "http://test"; -const char kHttpRedirectToSameDomainUrl1[] = "http://test/ing"; -const char kHttpRedirectToSameDomainUrl2[] = "http://test/ing2"; -const char kHttpRedirectToDifferentDomainUrl1[] = "http://test2"; -const char kHttpRedirectToDifferentDomainUrl2[] = "http://test2/ing"; +static const char* kHttpUrl = "http://test"; +static const char kHttpRedirectToSameDomainUrl1[] = "http://test/ing"; +static const char kHttpRedirectToSameDomainUrl2[] = "http://test/ing2"; +static const char kHttpRedirectToDifferentDomainUrl1[] = "http://test2"; +static const char kHttpRedirectToDifferentDomainUrl2[] = "http://test2/ing"; -const int kDataSize = 1024; -const int kHttpOK = 200; -const int kHttpPartialContent = 206; +static const int kDataSize = 1024; +static const int kHttpOK = 200; +static const int kHttpPartialContent = 206; enum NetworkState { NONE, @@ -56,10 +56,6 @@ enum NetworkState { LOADING }; -} // namespace - -namespace webkit_glue { - // Submit a request completed event to the resource loader due to request // being canceled. Pretending the event is from external. ACTION_P(RequestCanceled, loader) { diff --git a/webkit/glue/media/simple_data_source.cc b/webkit/glue/media/simple_data_source.cc index 48da431..5c3eb18 100644 --- a/webkit/glue/media/simple_data_source.cc +++ b/webkit/glue/media/simple_data_source.cc @@ -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. @@ -14,14 +14,10 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebKitClient.h" #include "webkit/glue/webkit_glue.h" -namespace { - -const char kDataScheme[] = "data"; - -} // namespace - namespace webkit_glue { +static const char kDataScheme[] = "data"; + SimpleDataSource::SimpleDataSource( MessageLoop* render_loop, WebKit::WebFrame* frame) diff --git a/webkit/glue/media/simple_data_source_unittest.cc b/webkit/glue/media/simple_data_source_unittest.cc index bfa8e1d..977807b 100644 --- a/webkit/glue/media/simple_data_source_unittest.cc +++ b/webkit/glue/media/simple_data_source_unittest.cc @@ -32,24 +32,20 @@ using WebKit::WebURLLoader; using WebKit::WebURLRequest; using WebKit::WebURLResponse; -namespace { +namespace webkit_glue { -const int kDataSize = 1024; -const char kHttpUrl[] = "http://test"; -const char kHttpsUrl[] = "https://test"; -const char kFileUrl[] = "file://test"; -const char kDataUrl[] = +static const int kDataSize = 1024; +static const char kHttpUrl[] = "http://test"; +static const char kHttpsUrl[] = "https://test"; +static const char kFileUrl[] = "file://test"; +static const char kDataUrl[] = "data:text/plain;base64,YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoK"; -const char kDataUrlDecoded[] = "abcdefghijklmnopqrstuvwxyz"; -const char kInvalidUrl[] = "whatever://test"; -const char kHttpRedirectToSameDomainUrl1[] = "http://test/ing"; -const char kHttpRedirectToSameDomainUrl2[] = "http://test/ing2"; -const char kHttpRedirectToDifferentDomainUrl1[] = "http://test2"; -const char kHttpRedirectToDifferentDomainUrl2[] = "http://test2/ing"; - -} // namespace - -namespace webkit_glue { +static const char kDataUrlDecoded[] = "abcdefghijklmnopqrstuvwxyz"; +static const char kInvalidUrl[] = "whatever://test"; +static const char kHttpRedirectToSameDomainUrl1[] = "http://test/ing"; +static const char kHttpRedirectToSameDomainUrl2[] = "http://test/ing2"; +static const char kHttpRedirectToDifferentDomainUrl1[] = "http://test2"; +static const char kHttpRedirectToDifferentDomainUrl2[] = "http://test2/ing"; class SimpleDataSourceTest : public testing::Test { public: |