This source file includes following definitions.
- source_
- SendResponse
- SendResponseOnIOThread
#include "content/browser/webui/url_data_source_impl.h"
#include "base/bind.h"
#include "base/memory/ref_counted_memory.h"
#include "base/strings/string_util.h"
#include "content/browser/webui/url_data_manager_backend.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/url_data_source.h"
namespace content {
URLDataSourceImpl::URLDataSourceImpl(const std::string& source_name,
URLDataSource* source)
: source_name_(source_name),
backend_(NULL),
source_(source) {
}
URLDataSourceImpl::~URLDataSourceImpl() {
}
void URLDataSourceImpl::SendResponse(
int request_id,
base::RefCountedMemory* bytes) {
scoped_refptr<base::RefCountedMemory> bytes_ptr(bytes);
if (URLDataManager::IsScheduledForDeletion(this)) {
return;
}
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(&URLDataSourceImpl::SendResponseOnIOThread, this, request_id,
bytes_ptr));
}
void URLDataSourceImpl::SendResponseOnIOThread(
int request_id,
scoped_refptr<base::RefCountedMemory> bytes) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
if (backend_)
backend_->DataAvailable(request_id, bytes.get());
}
}