summaryrefslogtreecommitdiffstats
path: root/ppapi/cpp/url_request_info.cc
diff options
context:
space:
mode:
authorneb@chromium.org <neb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-20 19:03:07 +0000
committerneb@chromium.org <neb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-20 19:03:07 +0000
commit6b7550abfbaa42801809e95609efad917cd64f18 (patch)
treec748a358dab03c9b8ce5490a02eee5ef3ef64085 /ppapi/cpp/url_request_info.cc
parentac873735ca81b77f9986e19b8c7f6347e9e026bc (diff)
downloadchromium_src-6b7550abfbaa42801809e95609efad917cd64f18.zip
chromium_src-6b7550abfbaa42801809e95609efad917cd64f18.tar.gz
chromium_src-6b7550abfbaa42801809e95609efad917cd64f18.tar.bz2
Remove static initializers.
BUG=52915 TEST=no new functionality, passes ppapi_tests Review URL: http://codereview.chromium.org/5797006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69732 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/cpp/url_request_info.cc')
-rw-r--r--ppapi/cpp/url_request_info.cc53
1 files changed, 28 insertions, 25 deletions
diff --git a/ppapi/cpp/url_request_info.cc b/ppapi/cpp/url_request_info.cc
index 69a86cb..30f339b 100644
--- a/ppapi/cpp/url_request_info.cc
+++ b/ppapi/cpp/url_request_info.cc
@@ -9,20 +9,21 @@
#include "ppapi/cpp/module.h"
#include "ppapi/cpp/module_impl.h"
+namespace pp {
+
namespace {
-DeviceFuncs<PPB_URLRequestInfo> url_request_info_f(
- PPB_URLREQUESTINFO_INTERFACE);
+template <> const char* interface_name<PPB_URLRequestInfo>() {
+ return PPB_URLREQUESTINFO_INTERFACE;
+}
} // namespace
-namespace pp {
-
URLRequestInfo::URLRequestInfo() {
- if (!url_request_info_f)
+ if (!has_interface<PPB_URLRequestInfo>())
return;
PassRefFromConstructor(
- url_request_info_f->Create(Module::Get()->pp_module()));
+ get_interface<PPB_URLRequestInfo>()->Create(Module::Get()->pp_module()));
}
URLRequestInfo::URLRequestInfo(const URLRequestInfo& other)
@@ -31,31 +32,30 @@ URLRequestInfo::URLRequestInfo(const URLRequestInfo& other)
bool URLRequestInfo::SetProperty(PP_URLRequestProperty property,
const Var& value) {
- if (!url_request_info_f)
+ if (!has_interface<PPB_URLRequestInfo>())
return false;
- return PPBoolToBool(url_request_info_f->SetProperty(pp_resource(),
- property,
- value.pp_var()));
+ return PPBoolToBool(get_interface<PPB_URLRequestInfo>()->SetProperty(
+ pp_resource(), property, value.pp_var()));
}
bool URLRequestInfo::AppendDataToBody(const char* data, uint32_t len) {
- if (!url_request_info_f)
+ if (!has_interface<PPB_URLRequestInfo>())
return false;
- return PPBoolToBool(url_request_info_f->AppendDataToBody(pp_resource(),
- data,
- len));
+ return PPBoolToBool(get_interface<PPB_URLRequestInfo>()->AppendDataToBody(
+ pp_resource(), data, len));
}
bool URLRequestInfo::AppendFileToBody(const FileRef_Dev& file_ref,
PP_Time expected_last_modified_time) {
- if (!url_request_info_f)
+ if (!has_interface<PPB_URLRequestInfo>())
return false;
return PPBoolToBool(
- url_request_info_f->AppendFileToBody(pp_resource(),
- file_ref.pp_resource(),
- 0,
- -1,
- expected_last_modified_time));
+ get_interface<PPB_URLRequestInfo>()->AppendFileToBody(
+ pp_resource(),
+ file_ref.pp_resource(),
+ 0,
+ -1,
+ expected_last_modified_time));
}
bool URLRequestInfo::AppendFileRangeToBody(
@@ -63,12 +63,15 @@ bool URLRequestInfo::AppendFileRangeToBody(
int64_t start_offset,
int64_t length,
PP_Time expected_last_modified_time) {
+ if (!has_interface<PPB_URLRequestInfo>())
+ return false;
return PPBoolToBool(
- url_request_info_f->AppendFileToBody(pp_resource(),
- file_ref.pp_resource(),
- start_offset,
- length,
- expected_last_modified_time));
+ get_interface<PPB_URLRequestInfo>()->AppendFileToBody(
+ pp_resource(),
+ file_ref.pp_resource(),
+ start_offset,
+ length,
+ expected_last_modified_time));
}
} // namespace pp