| OLD | NEW |
| 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/profiler_ui.h" | 5 #include "chrome/browser/ui/webui/profiler_ui.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 // When testing the javacript code, it is cumbersome to have to keep | 9 // When testing the javacript code, it is cumbersome to have to keep |
| 10 // re-building the resouces package and reloading the browser. To solve | 10 // re-building the resouces package and reloading the browser. To solve |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 97 |
| 98 #else // USE_SOURCE_FILES_DIRECTLY | 98 #else // USE_SOURCE_FILES_DIRECTLY |
| 99 | 99 |
| 100 content::WebUIDataSource* CreateProfilerHTMLSource() { | 100 content::WebUIDataSource* CreateProfilerHTMLSource() { |
| 101 content::WebUIDataSource* source = | 101 content::WebUIDataSource* source = |
| 102 content::WebUIDataSource::Create(chrome::kChromeUIProfilerHost); | 102 content::WebUIDataSource::Create(chrome::kChromeUIProfilerHost); |
| 103 | 103 |
| 104 source->SetJsonPath("strings.js"); | 104 source->SetJsonPath("strings.js"); |
| 105 source->AddResourcePath("profiler.js", IDR_PROFILER_JS); | 105 source->AddResourcePath("profiler.js", IDR_PROFILER_JS); |
| 106 source->SetDefaultResource(IDR_PROFILER_HTML); | 106 source->SetDefaultResource(IDR_PROFILER_HTML); |
| 107 source->DisableI18nAndUseGzipForAllPaths(); |
| 107 return source; | 108 return source; |
| 108 } | 109 } |
| 109 | 110 |
| 110 #endif | 111 #endif |
| 111 | 112 |
| 112 // This class receives javascript messages from the renderer. | 113 // This class receives javascript messages from the renderer. |
| 113 // Note that the WebUI infrastructure runs on the UI thread, therefore all of | 114 // Note that the WebUI infrastructure runs on the UI thread, therefore all of |
| 114 // this class's methods are expected to run on the UI thread. | 115 // this class's methods are expected to run on the UI thread. |
| 115 class ProfilerMessageHandler : public WebUIMessageHandler { | 116 class ProfilerMessageHandler : public WebUIMessageHandler { |
| 116 public: | 117 public: |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 // Serialize the data to JSON. | 170 // Serialize the data to JSON. |
| 170 base::DictionaryValue json_data; | 171 base::DictionaryValue json_data; |
| 171 task_profiler::TaskProfilerDataSerializer::ToValue( | 172 task_profiler::TaskProfilerDataSerializer::ToValue( |
| 172 process_data_phase, attributes.process_id, attributes.process_type, | 173 process_data_phase, attributes.process_id, attributes.process_type, |
| 173 &json_data); | 174 &json_data); |
| 174 | 175 |
| 175 // Send the data to the renderer. | 176 // Send the data to the renderer. |
| 176 web_ui()->CallJavascriptFunctionUnsafe("g_browserBridge.receivedData", | 177 web_ui()->CallJavascriptFunctionUnsafe("g_browserBridge.receivedData", |
| 177 json_data); | 178 json_data); |
| 178 } | 179 } |
| OLD | NEW |