summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-21 23:07:45 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-21 23:07:45 +0000
commit4d3aec119b4617fd3b75eeffa150724985798f4e (patch)
tree9a8fa1d70e826875a4a7f01e398b6986adb3fb55 /ppapi/proxy
parentcc6c5d6fab9bacf150042cc83654d9ffa86e367e (diff)
downloadchromium_src-4d3aec119b4617fd3b75eeffa150724985798f4e.zip
chromium_src-4d3aec119b4617fd3b75eeffa150724985798f4e.tar.gz
chromium_src-4d3aec119b4617fd3b75eeffa150724985798f4e.tar.bz2
Proxy time zone requests to the browser. This is because the current code
can't run in the sandbox on Linux. TEST=manual BUG=80176 Review URL: http://codereview.chromium.org/6891001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82575 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy')
-rw-r--r--ppapi/proxy/ppapi_messages.h4
-rw-r--r--ppapi/proxy/ppb_flash_proxy.cc37
-rw-r--r--ppapi/proxy/ppb_flash_proxy.h3
3 files changed, 29 insertions, 15 deletions
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index 9df5270..32dfdf2 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -437,6 +437,10 @@ IPC_SYNC_MESSAGE_ROUTED1_0(PpapiHostMsg_PPBFlash_RunMessageLoop,
PP_Instance /* instance */)
IPC_SYNC_MESSAGE_ROUTED1_0(PpapiHostMsg_PPBFlash_QuitMessageLoop,
PP_Instance /* instance */)
+IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBFlash_GetLocalTimeZoneOffset,
+ PP_Instance /* instance */,
+ PP_Time /* t */,
+ double /* offset */)
// PPB_Flash_Clipboard.
IPC_SYNC_MESSAGE_ROUTED3_1(PpapiHostMsg_PPBFlashClipboard_IsFormatAvailable,
diff --git a/ppapi/proxy/ppb_flash_proxy.cc b/ppapi/proxy/ppb_flash_proxy.cc
index 83c9b63..1b93f36 100644
--- a/ppapi/proxy/ppb_flash_proxy.cc
+++ b/ppapi/proxy/ppb_flash_proxy.cc
@@ -115,7 +115,7 @@ void RunMessageLoop(PP_Instance instance) {
if (!dispatcher)
return;
IPC::SyncMessage* msg = new PpapiHostMsg_PPBFlash_RunMessageLoop(
- INTERFACE_ID_PPB_FLASH, instance);
+ INTERFACE_ID_PPB_FLASH, instance);
msg->EnableMessagePumping();
dispatcher->Send(msg);
}
@@ -125,23 +125,24 @@ void QuitMessageLoop(PP_Instance instance) {
if (!dispatcher)
return;
dispatcher->Send(new PpapiHostMsg_PPBFlash_QuitMessageLoop(
- INTERFACE_ID_PPB_FLASH, instance));
+ INTERFACE_ID_PPB_FLASH, instance));
}
-double GetLocalTimeZoneOffset(PP_Time t) {
- // Somewhat horrible: Explode it to local time and then unexplode it as if
- // it were UTC. Also explode it to UTC and unexplode it (this avoids
- // mismatching rounding or lack thereof). The time zone offset is their
- // difference.
+double GetLocalTimeZoneOffset(PP_Instance instance, PP_Time t) {
+ PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
+ if (!dispatcher)
+ return 0.0;
+
+ // TODO(brettw) on Windows it should be possible to do the time calculation
+ // in-process since it doesn't need to read files on disk. This will improve
+ // performance.
//
- // TODO(brettw) this is duplicated in ppb_flash_impl.cc, unify these!
- base::Time cur = base::Time::FromDoubleT(t);
- base::Time::Exploded exploded;
- cur.LocalExplode(&exploded);
- base::Time adj_time = base::Time::FromUTCExploded(exploded);
- cur.UTCExplode(&exploded);
- cur = base::Time::FromUTCExploded(exploded);
- return (adj_time - cur).InSecondsF();
+ // On Linux, it would be better to go directly to the browser process for
+ // this message rather than proxy it through some instance in a renderer.
+ double result = 0;
+ dispatcher->Send(new PpapiHostMsg_PPBFlash_GetLocalTimeZoneOffset(
+ INTERFACE_ID_PPB_FLASH, instance, t, &result));
+ return result;
}
const PPB_Flash flash_interface = {
@@ -260,5 +261,11 @@ void PPB_Flash_Proxy::OnMsgQuitMessageLoop(PP_Instance instance) {
ppb_flash_target()->QuitMessageLoop(instance);
}
+void PPB_Flash_Proxy::OnMsgGetLocalTimeZoneOffset(PP_Instance instance,
+ PP_Time t,
+ double* result) {
+ *result = ppb_flash_target()->GetLocalTimeZoneOffset(instance, t);
+}
+
} // namespace proxy
} // namespace pp
diff --git a/ppapi/proxy/ppb_flash_proxy.h b/ppapi/proxy/ppb_flash_proxy.h
index 9666e4b..4449bf5 100644
--- a/ppapi/proxy/ppb_flash_proxy.h
+++ b/ppapi/proxy/ppb_flash_proxy.h
@@ -10,6 +10,7 @@
#include "ipc/ipc_platform_file.h"
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_module.h"
+#include "ppapi/c/pp_time.h"
#include "ppapi/proxy/host_resource.h"
#include "ppapi/proxy/interface_proxy.h"
@@ -51,6 +52,8 @@ class PPB_Flash_Proxy : public InterfaceProxy {
int32_t* result);
void OnMsgRunMessageLoop(PP_Instance instance);
void OnMsgQuitMessageLoop(PP_Instance instance);
+ void OnMsgGetLocalTimeZoneOffset(PP_Instance instance, PP_Time t,
+ double* result);
};
} // namespace proxy