| Index: content/browser/devtools/protocol/system_info_handler.cc
|
| diff --git a/content/browser/devtools/protocol/system_info_handler.cc b/content/browser/devtools/protocol/system_info_handler.cc
|
| index aa32e58e928bbdda9c41784b205fd85d1de06189..383f62be911d174c4e9351ea5659afd935a4d080 100644
|
| --- a/content/browser/devtools/protocol/system_info_handler.cc
|
| +++ b/content/browser/devtools/protocol/system_info_handler.cc
|
| @@ -90,11 +90,12 @@ scoped_refptr<GPUDevice> GPUDeviceToProtocol(
|
| class SystemInfoHandlerGpuObserver : public content::GpuDataManagerObserver {
|
| public:
|
| SystemInfoHandlerGpuObserver(base::WeakPtr<SystemInfoHandler> handler,
|
| + int session_id,
|
| DevToolsCommandId command_id)
|
| : handler_(handler),
|
| + session_id_(session_id),
|
| command_id_(command_id),
|
| - observer_id_(++next_observer_id_)
|
| - {
|
| + observer_id_(++next_observer_id_) {
|
| if (handler_) {
|
| handler_->AddActiveObserverId(observer_id_);
|
| }
|
| @@ -112,7 +113,7 @@ class SystemInfoHandlerGpuObserver : public content::GpuDataManagerObserver {
|
| GpuDataManager::GetInstance()->RemoveObserver(this);
|
| if (handler_.get()) {
|
| if (handler_->RemoveActiveObserverId(observer_id_)) {
|
| - handler_->SendGetInfoResponse(command_id_);
|
| + handler_->SendGetInfoResponse(session_id_, command_id_);
|
| }
|
| }
|
| delete this;
|
| @@ -124,6 +125,7 @@ class SystemInfoHandlerGpuObserver : public content::GpuDataManagerObserver {
|
|
|
| private:
|
| base::WeakPtr<SystemInfoHandler> handler_;
|
| + int session_id_;
|
| DevToolsCommandId command_id_;
|
| int observer_id_;
|
|
|
| @@ -143,7 +145,8 @@ void SystemInfoHandler::SetClient(scoped_ptr<Client> client) {
|
| client_.swap(client);
|
| }
|
|
|
| -Response SystemInfoHandler::GetInfo(DevToolsCommandId command_id) {
|
| +Response SystemInfoHandler::GetInfo(int session_id,
|
| + DevToolsCommandId command_id) {
|
| std::string reason;
|
| if (!GpuDataManager::GetInstance()->GpuAccessAllowed(&reason) ||
|
| GpuDataManager::GetInstance()->IsEssentialGpuInfoAvailable()) {
|
| @@ -155,24 +158,20 @@ Response SystemInfoHandler::GetInfo(DevToolsCommandId command_id) {
|
| // frequently hit internal timeouts in the launching of the unsandboxed
|
| // GPU process in debug builds on Windows.
|
| BrowserThread::PostTask(
|
| - BrowserThread::UI,
|
| - FROM_HERE,
|
| + BrowserThread::UI, FROM_HERE,
|
| base::Bind(&SystemInfoHandler::SendGetInfoResponse,
|
| - weak_factory_.GetWeakPtr(),
|
| - command_id));
|
| + weak_factory_.GetWeakPtr(), session_id, command_id));
|
| } else {
|
| // We will be able to get more information from the GpuDataManager.
|
| // Register a transient observer with it to call us back when the
|
| // information is available.
|
| SystemInfoHandlerGpuObserver* observer = new SystemInfoHandlerGpuObserver(
|
| - weak_factory_.GetWeakPtr(), command_id);
|
| + weak_factory_.GetWeakPtr(), session_id, command_id);
|
| BrowserThread::PostDelayedTask(
|
| - BrowserThread::UI,
|
| - FROM_HERE,
|
| + BrowserThread::UI, FROM_HERE,
|
| base::Bind(&SystemInfoHandler::ObserverWatchdogCallback,
|
| - weak_factory_.GetWeakPtr(),
|
| - observer->GetObserverId(),
|
| - command_id),
|
| + weak_factory_.GetWeakPtr(), observer->GetObserverId(),
|
| + session_id, command_id),
|
| base::TimeDelta::FromMilliseconds(kGPUInfoWatchdogTimeoutMs));
|
| GpuDataManager::GetInstance()->AddObserver(observer);
|
| // There's no other method available to request just essential GPU info.
|
| @@ -182,7 +181,8 @@ Response SystemInfoHandler::GetInfo(DevToolsCommandId command_id) {
|
| return Response::OK();
|
| }
|
|
|
| -void SystemInfoHandler::SendGetInfoResponse(DevToolsCommandId command_id) {
|
| +void SystemInfoHandler::SendGetInfoResponse(int session_id,
|
| + DevToolsCommandId command_id) {
|
| gpu::GPUInfo gpu_info = GpuDataManager::GetInstance()->GetGPUInfo();
|
| std::vector<scoped_refptr<GPUDevice>> devices;
|
| devices.push_back(GPUDeviceToProtocol(gpu_info.gpu));
|
| @@ -200,10 +200,11 @@ void SystemInfoHandler::SendGetInfoResponse(DevToolsCommandId command_id) {
|
| ->set_driver_bug_workarounds(GetDriverBugWorkarounds());
|
|
|
| client_->SendGetInfoResponse(
|
| - command_id,
|
| - GetInfoResponse::Create()->set_gpu(gpu)
|
| - ->set_model_name(gpu_info.machine_model_name)
|
| - ->set_model_version(gpu_info.machine_model_version));
|
| + session_id, command_id,
|
| + GetInfoResponse::Create()
|
| + ->set_gpu(gpu)
|
| + ->set_model_name(gpu_info.machine_model_name)
|
| + ->set_model_version(gpu_info.machine_model_version));
|
| }
|
|
|
| void SystemInfoHandler::AddActiveObserverId(int observer_id) {
|
| @@ -218,10 +219,11 @@ bool SystemInfoHandler::RemoveActiveObserverId(int observer_id) {
|
| }
|
|
|
| void SystemInfoHandler::ObserverWatchdogCallback(int observer_id,
|
| + int session_id,
|
| DevToolsCommandId command_id) {
|
| DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
| if (RemoveActiveObserverId(observer_id)) {
|
| - SendGetInfoResponse(command_id);
|
| + SendGetInfoResponse(session_id, command_id);
|
| // For the time being we want to know about this event in the test logs.
|
| LOG(ERROR) << "SystemInfoHandler: request for GPU info timed out!"
|
| << " Most recent info sent.";
|
|
|