Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Side by Side Diff: chrome/browser/ui/webui/nacl_ui.cc

Issue 2673913002: Use TaskScheduler instead of blocking pool in nacl_ui.cc. (Closed)
Patch Set: upload Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/nacl_ui.h" 5 #include "chrome/browser/ui/webui/nacl_ui.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
11 #include <utility> 11 #include <utility>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/bind_helpers.h" 15 #include "base/bind_helpers.h"
16 #include "base/command_line.h" 16 #include "base/command_line.h"
17 #include "base/files/file_util.h" 17 #include "base/files/file_util.h"
18 #include "base/json/json_file_value_serializer.h" 18 #include "base/json/json_file_value_serializer.h"
19 #include "base/macros.h" 19 #include "base/macros.h"
20 #include "base/memory/ptr_util.h" 20 #include "base/memory/ptr_util.h"
21 #include "base/memory/weak_ptr.h" 21 #include "base/memory/weak_ptr.h"
22 #include "base/path_service.h" 22 #include "base/path_service.h"
23 #include "base/strings/string16.h" 23 #include "base/strings/string16.h"
24 #include "base/strings/string_number_conversions.h" 24 #include "base/strings/string_number_conversions.h"
25 #include "base/strings/utf_string_conversions.h" 25 #include "base/strings/utf_string_conversions.h"
26 #include "base/task_scheduler/post_task.h"
26 #include "base/threading/sequenced_worker_pool.h" 27 #include "base/threading/sequenced_worker_pool.h"
27 #include "base/values.h" 28 #include "base/values.h"
28 #include "build/build_config.h" 29 #include "build/build_config.h"
29 #include "chrome/browser/plugins/plugin_prefs.h" 30 #include "chrome/browser/plugins/plugin_prefs.h"
30 #include "chrome/browser/profiles/profile.h" 31 #include "chrome/browser/profiles/profile.h"
31 #include "chrome/common/channel_info.h" 32 #include "chrome/common/channel_info.h"
32 #include "chrome/common/chrome_paths.h" 33 #include "chrome/common/chrome_paths.h"
33 #include "chrome/common/chrome_switches.h" 34 #include "chrome/common/chrome_switches.h"
34 #include "chrome/common/url_constants.h" 35 #include "chrome/common/url_constants.h"
35 #include "chrome/grit/browser_resources.h" 36 #include "chrome/grit/browser_resources.h"
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 } 357 }
357 358
358 void NaClDomHandler::MaybeRespondToPage() { 359 void NaClDomHandler::MaybeRespondToPage() {
359 // Don't reply until everything is ready. The page will show a 'loading' 360 // Don't reply until everything is ready. The page will show a 'loading'
360 // message until then. 361 // message until then.
361 if (!page_has_requested_data_ || !has_plugin_info_) 362 if (!page_has_requested_data_ || !has_plugin_info_)
362 return; 363 return;
363 364
364 if (!pnacl_path_validated_) { 365 if (!pnacl_path_validated_) {
365 std::string* version_string = new std::string; 366 std::string* version_string = new std::string;
366 base::PostTaskAndReplyWithResult( 367 base::PostTaskWithTraitsAndReplyWithResult(
367 BrowserThread::GetBlockingPool(), 368 FROM_HERE, base::TaskTraits().MayBlock().WithPriority(
368 FROM_HERE, 369 base::TaskPriority::BACKGROUND),
369 base::Bind(&CheckPathAndVersion, version_string), 370 base::Bind(&CheckPathAndVersion, version_string),
370 base::Bind(&NaClDomHandler::DidCheckPathAndVersion, 371 base::Bind(&NaClDomHandler::DidCheckPathAndVersion,
371 weak_ptr_factory_.GetWeakPtr(), 372 weak_ptr_factory_.GetWeakPtr(),
372 base::Owned(version_string))); 373 base::Owned(version_string)));
373 return; 374 return;
374 } 375 }
375 376
376 base::DictionaryValue naclInfo; 377 base::DictionaryValue naclInfo;
377 PopulatePageInformation(&naclInfo); 378 PopulatePageInformation(&naclInfo);
378 web_ui()->CallJavascriptFunctionUnsafe("nacl.returnNaClInfo", naclInfo); 379 web_ui()->CallJavascriptFunctionUnsafe("nacl.returnNaClInfo", naclInfo);
379 } 380 }
380 381
381 } // namespace 382 } // namespace
382 383
383 /////////////////////////////////////////////////////////////////////////////// 384 ///////////////////////////////////////////////////////////////////////////////
384 // 385 //
385 // NaClUI 386 // NaClUI
386 // 387 //
387 /////////////////////////////////////////////////////////////////////////////// 388 ///////////////////////////////////////////////////////////////////////////////
388 389
389 NaClUI::NaClUI(content::WebUI* web_ui) : WebUIController(web_ui) { 390 NaClUI::NaClUI(content::WebUI* web_ui) : WebUIController(web_ui) {
390 content::RecordAction(UserMetricsAction("ViewAboutNaCl")); 391 content::RecordAction(UserMetricsAction("ViewAboutNaCl"));
391 392
392 web_ui->AddMessageHandler(base::MakeUnique<NaClDomHandler>()); 393 web_ui->AddMessageHandler(base::MakeUnique<NaClDomHandler>());
393 394
394 // Set up the about:nacl source. 395 // Set up the about:nacl source.
395 Profile* profile = Profile::FromWebUI(web_ui); 396 Profile* profile = Profile::FromWebUI(web_ui);
396 content::WebUIDataSource::Add(profile, CreateNaClUIHTMLSource()); 397 content::WebUIDataSource::Add(profile, CreateNaClUIHTMLSource());
397 } 398 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698