use type std::string instead of integer for MediaLogEvent::TOTAL_BYTES_SET

because overflow happens for integer larger than 2^31. 

original review url: http://codereview.chromium.org/10828226

BUG=120328


Review URL: https://chromiumcodereview.appspot.com/10832334

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151861 0039d316-1c4b-4281-b951-d872f2087c98
parent c96a456d
...@@ -173,6 +173,7 @@ Mao Yujie <yujie.mao@intel.com> ...@@ -173,6 +173,7 @@ Mao Yujie <yujie.mao@intel.com>
Xu Samuel <samuel.xu@intel.com> Xu Samuel <samuel.xu@intel.com>
Jin Yang <jin.a.yang@intel.com> Jin Yang <jin.a.yang@intel.com>
Xinchao He <hexinchao@gmail.com> Xinchao He <hexinchao@gmail.com>
Changbin Shao <changbin.shao@intel.com>
Stephen Searles <stephen.searles@gmail.com> Stephen Searles <stephen.searles@gmail.com>
Arun Mankuzhi <arun.m@samsung.com> Arun Mankuzhi <arun.m@samsung.com>
Taylor Price <trprice@gmail.com> Taylor Price <trprice@gmail.com>
......
...@@ -152,10 +152,10 @@ scoped_ptr<MediaLogEvent> MediaLog::CreateBooleanEvent( ...@@ -152,10 +152,10 @@ scoped_ptr<MediaLogEvent> MediaLog::CreateBooleanEvent(
return event.Pass(); return event.Pass();
} }
scoped_ptr<MediaLogEvent> MediaLog::CreateIntegerEvent( scoped_ptr<MediaLogEvent> MediaLog::CreateStringEvent(
MediaLogEvent::Type type, const char* property, int64 value) { MediaLogEvent::Type type, const char* property, const std::string& value) {
scoped_ptr<MediaLogEvent> event(CreateEvent(type)); scoped_ptr<MediaLogEvent> event(CreateEvent(type));
event->params.SetInteger(property, value); event->params.SetString(property, value);
return event.Pass(); return event.Pass();
} }
......
...@@ -31,8 +31,8 @@ class MEDIA_EXPORT MediaLog : public base::RefCountedThreadSafe<MediaLog> { ...@@ -31,8 +31,8 @@ class MEDIA_EXPORT MediaLog : public base::RefCountedThreadSafe<MediaLog> {
scoped_ptr<MediaLogEvent> CreateEvent(MediaLogEvent::Type type); scoped_ptr<MediaLogEvent> CreateEvent(MediaLogEvent::Type type);
scoped_ptr<MediaLogEvent> CreateBooleanEvent( scoped_ptr<MediaLogEvent> CreateBooleanEvent(
MediaLogEvent::Type type, const char* property, bool value); MediaLogEvent::Type type, const char* property, bool value);
scoped_ptr<MediaLogEvent> CreateIntegerEvent( scoped_ptr<MediaLogEvent> CreateStringEvent(
MediaLogEvent::Type type, const char* property, int64 value); MediaLogEvent::Type type, const char* property, const std::string& value);
scoped_ptr<MediaLogEvent> CreateTimeEvent( scoped_ptr<MediaLogEvent> CreateTimeEvent(
MediaLogEvent::Type type, const char* property, base::TimeDelta value); MediaLogEvent::Type type, const char* property, base::TimeDelta value);
scoped_ptr<MediaLogEvent> CreateLoadEvent(const std::string& url); scoped_ptr<MediaLogEvent> CreateLoadEvent(const std::string& url);
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "base/metrics/histogram.h" #include "base/metrics/histogram.h"
#include "base/message_loop.h" #include "base/message_loop.h"
#include "base/stl_util.h" #include "base/stl_util.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h" #include "base/string_util.h"
#include "base/synchronization/condition_variable.h" #include "base/synchronization/condition_variable.h"
#include "media/base/audio_decoder.h" #include "media/base/audio_decoder.h"
...@@ -390,8 +391,9 @@ void Pipeline::SetDuration(TimeDelta duration) { ...@@ -390,8 +391,9 @@ void Pipeline::SetDuration(TimeDelta duration) {
void Pipeline::SetTotalBytes(int64 total_bytes) { void Pipeline::SetTotalBytes(int64 total_bytes) {
DCHECK(IsRunning()); DCHECK(IsRunning());
media_log_->AddEvent( media_log_->AddEvent(
media_log_->CreateIntegerEvent( media_log_->CreateStringEvent(
MediaLogEvent::TOTAL_BYTES_SET, "total_bytes", total_bytes)); MediaLogEvent::TOTAL_BYTES_SET, "total_bytes",
base::Int64ToString(total_bytes)));
int64 total_mbytes = total_bytes >> 20; int64 total_mbytes = total_bytes >> 20;
if (total_mbytes > kint32max) if (total_mbytes > kint32max)
total_mbytes = kint32max; total_mbytes = kint32max;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment