This source file includes following definitions.
- OnDetailsAvailable
- Fetch
#include "chrome/browser/feedback/system_logs/log_sources/memory_details_log_source.h"
#include "chrome/browser/memory_details.h"
#include "content/public/browser/browser_thread.h"
namespace system_logs {
class SystemLogsMemoryHandler : public MemoryDetails {
public:
explicit SystemLogsMemoryHandler(const SysLogsSourceCallback& callback)
: callback_(callback) {}
virtual void OnDetailsAvailable() OVERRIDE {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
scoped_ptr<SystemLogsResponse> response(new SystemLogsResponse);
(*response)["mem_usage"] = ToLogString();
callback_.Run(response.get());
}
private:
virtual ~SystemLogsMemoryHandler() {}
SysLogsSourceCallback callback_;
DISALLOW_COPY_AND_ASSIGN(SystemLogsMemoryHandler);
};
void MemoryDetailsLogSource::Fetch(const SysLogsSourceCallback& callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK(!callback.is_null());
scoped_refptr<SystemLogsMemoryHandler>
handler(new SystemLogsMemoryHandler(callback));
handler->StartFetch(MemoryDetails::UPDATE_USER_METRICS);
}
}