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

Side by Side Diff: android_webview/browser/aw_browser_main_parts.cc

Issue 1030053006: [android_webview] Convert VLOGs to DVLOGs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added myname into Authors files Created 5 years, 8 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 | « AUTHORS ('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 (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 "android_webview/browser/aw_browser_main_parts.h" 5 #include "android_webview/browser/aw_browser_main_parts.h"
6 6
7 #include "android_webview/browser/aw_browser_context.h" 7 #include "android_webview/browser/aw_browser_context.h"
8 #include "android_webview/browser/aw_result_codes.h" 8 #include "android_webview/browser/aw_result_codes.h"
9 #include "android_webview/native/public/aw_assets.h" 9 #include "android_webview/native/public/aw_assets.h"
10 #include "base/android/build_info.h" 10 #include "base/android/build_info.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 // instance to be present to work correctly so we call this (knowing it will 53 // instance to be present to work correctly so we call this (knowing it will
54 // fail) just to create the ResourceBundle instance. We should refactor 54 // fail) just to create the ResourceBundle instance. We should refactor
55 // ResourceBundle/GetApplicationLocale to not require an instance to be 55 // ResourceBundle/GetApplicationLocale to not require an instance to be
56 // initialized. 56 // initialized.
57 ui::ResourceBundle::InitSharedInstanceWithLocale( 57 ui::ResourceBundle::InitSharedInstanceWithLocale(
58 base::android::GetDefaultLocale(), 58 base::android::GetDefaultLocale(),
59 NULL, 59 NULL,
60 ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES); 60 ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES);
61 std::string locale = l10n_util::GetApplicationLocale(std::string()) + ".pak"; 61 std::string locale = l10n_util::GetApplicationLocale(std::string()) + ".pak";
62 if (AwAssets::OpenAsset(locale, &pak_fd, &pak_off, &pak_len)) { 62 if (AwAssets::OpenAsset(locale, &pak_fd, &pak_off, &pak_len)) {
63 VLOG(0) << "Load from apk succesful, fd=" << pak_fd << " off=" << pak_off
64 << " len=" << pak_len;
65 ui::ResourceBundle::CleanupSharedInstance(); 63 ui::ResourceBundle::CleanupSharedInstance();
66 ui::ResourceBundle::InitSharedInstanceWithPakFileRegion( 64 ui::ResourceBundle::InitSharedInstanceWithPakFileRegion(
67 base::File(pak_fd), base::MemoryMappedFile::Region(pak_off, pak_len)); 65 base::File(pak_fd), base::MemoryMappedFile::Region(pak_off, pak_len));
68 } else { 66 } else {
69 LOG(WARNING) << "Failed to load " << locale << ".pak from the apk too. " 67 LOG(WARNING) << "Failed to load " << locale << ".pak from the apk too. "
70 "Bringing up WebView without any locale"; 68 "Bringing up WebView without any locale";
71 } 69 }
72 70
73 // Try to directly mmap the webviewchromium.pak from the apk. Fall back to 71 // Try to directly mmap the webviewchromium.pak from the apk. Fall back to
74 // load from file, using PATH_SERVICE, otherwise. 72 // load from file, using PATH_SERVICE, otherwise.
75 if (AwAssets::OpenAsset("webviewchromium.pak", &pak_fd, &pak_off, &pak_len)) { 73 if (AwAssets::OpenAsset("webviewchromium.pak", &pak_fd, &pak_off, &pak_len)) {
76 VLOG(0) << "Loading webviewchromium.pak from, fd:" << pak_fd
77 << " off:" << pak_off << " len:" << pak_len;
78 ui::ResourceBundle::GetSharedInstance().AddDataPackFromFileRegion( 74 ui::ResourceBundle::GetSharedInstance().AddDataPackFromFileRegion(
79 base::File(pak_fd), 75 base::File(pak_fd),
80 base::MemoryMappedFile::Region(pak_off, pak_len), 76 base::MemoryMappedFile::Region(pak_off, pak_len),
81 ui::SCALE_FACTOR_NONE); 77 ui::SCALE_FACTOR_NONE);
82 } else { 78 } else {
83 base::FilePath pak_path; 79 base::FilePath pak_path;
84 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &pak_path); 80 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &pak_path);
85 LOG(WARNING) << "Cannot load webviewchromium.pak assets from the apk. " 81 LOG(WARNING) << "Cannot load webviewchromium.pak assets from the apk. "
86 "Falling back loading it from " << pak_path.MaybeAsASCII(); 82 "Falling back loading it from " << pak_path.MaybeAsASCII();
87 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( 83 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
(...skipping 13 matching lines...) Expand all
101 content::SetMaxURLChars(20 * 1024 * 1024); 97 content::SetMaxURLChars(20 * 1024 * 1024);
102 } 98 }
103 99
104 bool AwBrowserMainParts::MainMessageLoopRun(int* result_code) { 100 bool AwBrowserMainParts::MainMessageLoopRun(int* result_code) {
105 // Android WebView does not use default MessageLoop. It has its own 101 // Android WebView does not use default MessageLoop. It has its own
106 // Android specific MessageLoop. 102 // Android specific MessageLoop.
107 return true; 103 return true;
108 } 104 }
109 105
110 } // namespace android_webview 106 } // namespace android_webview
OLDNEW
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698