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

Side by Side Diff: chrome/browser/devtools/devtools_ui_bindings.cc

Issue 1030263002: favor DCHECK_CURRENTLY_ON for better logs in chrome/browser/devtools (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 | « chrome/browser/devtools/devtools_targets_ui.cc ('k') | 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/devtools/devtools_ui_bindings.h" 5 #include "chrome/browser/devtools/devtools_ui_bindings.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 file_helper_->UpgradeDraggedFileSystemPermissions( 648 file_helper_->UpgradeDraggedFileSystemPermissions(
649 file_system_url, 649 file_system_url,
650 base::Bind(&DevToolsUIBindings::FileSystemAdded, 650 base::Bind(&DevToolsUIBindings::FileSystemAdded,
651 weak_factory_.GetWeakPtr()), 651 weak_factory_.GetWeakPtr()),
652 base::Bind(&DevToolsUIBindings::ShowDevToolsConfirmInfoBar, 652 base::Bind(&DevToolsUIBindings::ShowDevToolsConfirmInfoBar,
653 weak_factory_.GetWeakPtr())); 653 weak_factory_.GetWeakPtr()));
654 } 654 }
655 655
656 void DevToolsUIBindings::IndexPath(int index_request_id, 656 void DevToolsUIBindings::IndexPath(int index_request_id,
657 const std::string& file_system_path) { 657 const std::string& file_system_path) {
658 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 658 DCHECK_CURRENTLY_ON(BrowserThread::UI);
659 CHECK(web_contents_->GetURL().SchemeIs(content::kChromeDevToolsScheme)); 659 CHECK(web_contents_->GetURL().SchemeIs(content::kChromeDevToolsScheme));
660 if (!file_helper_->IsFileSystemAdded(file_system_path)) { 660 if (!file_helper_->IsFileSystemAdded(file_system_path)) {
661 IndexingDone(index_request_id, file_system_path); 661 IndexingDone(index_request_id, file_system_path);
662 return; 662 return;
663 } 663 }
664 if (indexing_jobs_.count(index_request_id) != 0) 664 if (indexing_jobs_.count(index_request_id) != 0)
665 return; 665 return;
666 indexing_jobs_[index_request_id] = 666 indexing_jobs_[index_request_id] =
667 scoped_refptr<DevToolsFileSystemIndexer::FileSystemIndexingJob>( 667 scoped_refptr<DevToolsFileSystemIndexer::FileSystemIndexingJob>(
668 file_system_indexer_->IndexPath( 668 file_system_indexer_->IndexPath(
669 file_system_path, 669 file_system_path,
670 Bind(&DevToolsUIBindings::IndexingTotalWorkCalculated, 670 Bind(&DevToolsUIBindings::IndexingTotalWorkCalculated,
671 weak_factory_.GetWeakPtr(), 671 weak_factory_.GetWeakPtr(),
672 index_request_id, 672 index_request_id,
673 file_system_path), 673 file_system_path),
674 Bind(&DevToolsUIBindings::IndexingWorked, 674 Bind(&DevToolsUIBindings::IndexingWorked,
675 weak_factory_.GetWeakPtr(), 675 weak_factory_.GetWeakPtr(),
676 index_request_id, 676 index_request_id,
677 file_system_path), 677 file_system_path),
678 Bind(&DevToolsUIBindings::IndexingDone, 678 Bind(&DevToolsUIBindings::IndexingDone,
679 weak_factory_.GetWeakPtr(), 679 weak_factory_.GetWeakPtr(),
680 index_request_id, 680 index_request_id,
681 file_system_path))); 681 file_system_path)));
682 } 682 }
683 683
684 void DevToolsUIBindings::StopIndexing(int index_request_id) { 684 void DevToolsUIBindings::StopIndexing(int index_request_id) {
685 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 685 DCHECK_CURRENTLY_ON(BrowserThread::UI);
686 IndexingJobsMap::iterator it = indexing_jobs_.find(index_request_id); 686 IndexingJobsMap::iterator it = indexing_jobs_.find(index_request_id);
687 if (it == indexing_jobs_.end()) 687 if (it == indexing_jobs_.end())
688 return; 688 return;
689 it->second->Stop(); 689 it->second->Stop();
690 indexing_jobs_.erase(it); 690 indexing_jobs_.erase(it);
691 } 691 }
692 692
693 void DevToolsUIBindings::SearchInPath(int search_request_id, 693 void DevToolsUIBindings::SearchInPath(int search_request_id,
694 const std::string& file_system_path, 694 const std::string& file_system_path,
695 const std::string& query) { 695 const std::string& query) {
696 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 696 DCHECK_CURRENTLY_ON(BrowserThread::UI);
697 CHECK(web_contents_->GetURL().SchemeIs(content::kChromeDevToolsScheme)); 697 CHECK(web_contents_->GetURL().SchemeIs(content::kChromeDevToolsScheme));
698 if (!file_helper_->IsFileSystemAdded(file_system_path)) { 698 if (!file_helper_->IsFileSystemAdded(file_system_path)) {
699 SearchCompleted(search_request_id, 699 SearchCompleted(search_request_id,
700 file_system_path, 700 file_system_path,
701 std::vector<std::string>()); 701 std::vector<std::string>());
702 return; 702 return;
703 } 703 }
704 file_system_indexer_->SearchInPath(file_system_path, 704 file_system_indexer_->SearchInPath(file_system_path,
705 query, 705 query,
706 Bind(&DevToolsUIBindings::SearchCompleted, 706 Bind(&DevToolsUIBindings::SearchCompleted,
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 if (!file_system.file_system_path.empty()) 873 if (!file_system.file_system_path.empty())
874 file_system_value.reset(CreateFileSystemValue(file_system)); 874 file_system_value.reset(CreateFileSystemValue(file_system));
875 CallClientFunction("DevToolsAPI.fileSystemAdded", 875 CallClientFunction("DevToolsAPI.fileSystemAdded",
876 error_string_value.get(), file_system_value.get(), NULL); 876 error_string_value.get(), file_system_value.get(), NULL);
877 } 877 }
878 878
879 void DevToolsUIBindings::IndexingTotalWorkCalculated( 879 void DevToolsUIBindings::IndexingTotalWorkCalculated(
880 int request_id, 880 int request_id,
881 const std::string& file_system_path, 881 const std::string& file_system_path,
882 int total_work) { 882 int total_work) {
883 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 883 DCHECK_CURRENTLY_ON(BrowserThread::UI);
884 base::FundamentalValue request_id_value(request_id); 884 base::FundamentalValue request_id_value(request_id);
885 base::StringValue file_system_path_value(file_system_path); 885 base::StringValue file_system_path_value(file_system_path);
886 base::FundamentalValue total_work_value(total_work); 886 base::FundamentalValue total_work_value(total_work);
887 CallClientFunction("DevToolsAPI.indexingTotalWorkCalculated", 887 CallClientFunction("DevToolsAPI.indexingTotalWorkCalculated",
888 &request_id_value, &file_system_path_value, 888 &request_id_value, &file_system_path_value,
889 &total_work_value); 889 &total_work_value);
890 } 890 }
891 891
892 void DevToolsUIBindings::IndexingWorked(int request_id, 892 void DevToolsUIBindings::IndexingWorked(int request_id,
893 const std::string& file_system_path, 893 const std::string& file_system_path,
894 int worked) { 894 int worked) {
895 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 895 DCHECK_CURRENTLY_ON(BrowserThread::UI);
896 base::FundamentalValue request_id_value(request_id); 896 base::FundamentalValue request_id_value(request_id);
897 base::StringValue file_system_path_value(file_system_path); 897 base::StringValue file_system_path_value(file_system_path);
898 base::FundamentalValue worked_value(worked); 898 base::FundamentalValue worked_value(worked);
899 CallClientFunction("DevToolsAPI.indexingWorked", &request_id_value, 899 CallClientFunction("DevToolsAPI.indexingWorked", &request_id_value,
900 &file_system_path_value, &worked_value); 900 &file_system_path_value, &worked_value);
901 } 901 }
902 902
903 void DevToolsUIBindings::IndexingDone(int request_id, 903 void DevToolsUIBindings::IndexingDone(int request_id,
904 const std::string& file_system_path) { 904 const std::string& file_system_path) {
905 indexing_jobs_.erase(request_id); 905 indexing_jobs_.erase(request_id);
906 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 906 DCHECK_CURRENTLY_ON(BrowserThread::UI);
907 base::FundamentalValue request_id_value(request_id); 907 base::FundamentalValue request_id_value(request_id);
908 base::StringValue file_system_path_value(file_system_path); 908 base::StringValue file_system_path_value(file_system_path);
909 CallClientFunction("DevToolsAPI.indexingDone", &request_id_value, 909 CallClientFunction("DevToolsAPI.indexingDone", &request_id_value,
910 &file_system_path_value, NULL); 910 &file_system_path_value, NULL);
911 } 911 }
912 912
913 void DevToolsUIBindings::SearchCompleted( 913 void DevToolsUIBindings::SearchCompleted(
914 int request_id, 914 int request_id,
915 const std::string& file_system_path, 915 const std::string& file_system_path,
916 const std::vector<std::string>& file_paths) { 916 const std::vector<std::string>& file_paths) {
917 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 917 DCHECK_CURRENTLY_ON(BrowserThread::UI);
918 base::ListValue file_paths_value; 918 base::ListValue file_paths_value;
919 for (std::vector<std::string>::const_iterator it(file_paths.begin()); 919 for (std::vector<std::string>::const_iterator it(file_paths.begin());
920 it != file_paths.end(); ++it) { 920 it != file_paths.end(); ++it) {
921 file_paths_value.AppendString(*it); 921 file_paths_value.AppendString(*it);
922 } 922 }
923 base::FundamentalValue request_id_value(request_id); 923 base::FundamentalValue request_id_value(request_id);
924 base::StringValue file_system_path_value(file_system_path); 924 base::StringValue file_system_path_value(file_system_path);
925 CallClientFunction("DevToolsAPI.searchCompleted", &request_id_value, 925 CallClientFunction("DevToolsAPI.searchCompleted", &request_id_value,
926 &file_system_path_value, &file_paths_value); 926 &file_system_path_value, &file_paths_value);
927 } 927 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 if (frontend_loaded_) 1041 if (frontend_loaded_)
1042 return; 1042 return;
1043 frontend_loaded_ = true; 1043 frontend_loaded_ = true;
1044 1044
1045 // Call delegate first - it seeds importants bit of information. 1045 // Call delegate first - it seeds importants bit of information.
1046 delegate_->OnLoadCompleted(); 1046 delegate_->OnLoadCompleted();
1047 1047
1048 UpdateTheme(); 1048 UpdateTheme();
1049 AddDevToolsExtensionsToClient(); 1049 AddDevToolsExtensionsToClient();
1050 } 1050 }
OLDNEW
« no previous file with comments | « chrome/browser/devtools/devtools_targets_ui.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698