1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/performance_monitor/event.h"
7 #include "base/logging.h"
9 namespace performance_monitor
{
11 Event::Event(const EventType
& type
,
12 const base::Time
& time
,
13 scoped_ptr
<base::DictionaryValue
> data
)
14 : type_(type
), time_(time
), data_(data
.release()) {
20 scoped_ptr
<Event
> Event::FromValue(scoped_ptr
<base::DictionaryValue
> data
) {
22 if (!data
->GetInteger(std::string("eventType"), &type
))
23 return scoped_ptr
<Event
>();
25 if (!data
->GetDouble(std::string("time"), &time
))
26 return scoped_ptr
<Event
>();
27 return scoped_ptr
<Event
>(new Event(static_cast<EventType
>(type
),
28 base::Time::FromInternalValue((int64
)time
),
32 } // namespace performance_monitor