New issue
Advanced search Search tips

Issue 805727 link

Starred by 1 user

Issue metadata

Status: Started
Owner:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android , Fuchsia
Pri: 3
Type: Task



Sign in to add a comment

Add DIR_ASSETS in base::PathService

Project Member Reported by sergeyu@chromium.org, Jan 25 2018

Issue description

Currently DIR_MODULE is used when loading assets such as ICU data or .pak files. On some platforms these files are stored in a separate directory. Android and Fuchsia solve this problem with DIR_ANDROID_APP_DATA and DIR_FUCHSIA_RESOURCE. This approach doesn't scale well because it requires adding platform-specific ifdefs when loading asset files, and this defeats the purpose of base::PathServer.

The proposal is to add cross-platform DIR_ASSETS that can be used on all
    platforms. The values is platform specific:
      Win/Linux/ChromeOS: DIR_ASSETS = DIR_MODULE
      Mac: DIR_ASSETS = <bundle_path>/Resources
                        or DIR_MODULE when not bundled.
      Android: DIR_ASSETS = DIR_ANDROID_APP_DATA
      Fuchsia: DIR_ASSETS = DIR_FUCHSIA_RESOURCE
                            or DIR_MODULE when not packaged.

DIR_ANDROID_APP_DATA and DIR_FUCHSIA_RESOURCE should be removed.

 
Project Member

Comment 1 by bugdroid1@chromium.org, Feb 7 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/d5ae68ebcd7cc869074e033de066d7f769477f16

commit d5ae68ebcd7cc869074e033de066d7f769477f16
Author: Sergey Ulanov <sergeyu@chromium.org>
Date: Wed Feb 07 20:14:21 2018

Add DIR_ASSETS in PathService.

Currently DIR_MODULE is used when loading assets such as ICU data or .pak
files. On some platforms these files are stored in a separate directory.
Fuchsia solves this problem with DIR_FUCHSIA_RESOURCE. Android uses
DIR_ANDROID_APP_DATA in tests. This approach doesn't scale well because it
requires platform-specific ifdefs when loading asset files, and this
defeats the purpose of base::PathServer.
This change adds cross-platform DIR_ASSETS that can be used on all
platforms. The values is platform specific:
  Win/Linux/ChromeOS: DIR_ASSETS = DIR_MODULE
  Mac: DIR_ASSETS = <bundle_path>/Resources
                    or DIR_MODULE when not bundled.
  Android: DIR_ASSETS = Undefined since resources are loaded from APK.
                        Overriden in test.
  Fuchsia: DIR_ASSETS = DIR_FUCHSIA_RESOURCE (i.e. /pkg)
                        or DIR_MODULE when not packaged.

Also removed DIR_FUCHSIA_RESOURCE and marked DIR_ANDROID_APP_DATA as
deprecated.

Bug: 805727, 617734
Change-Id: Id54305669f786c41c2dde0851daea1504547a866
Reviewed-on: https://chromium-review.googlesource.com/885002
Reviewed-by: danakj <danakj@chromium.org>
Reviewed-by: Wez <wez@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: Kevin Marshall <kmarshall@chromium.org>
Commit-Queue: Sergey Ulanov <sergeyu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#535118}
[modify] https://crrev.com/d5ae68ebcd7cc869074e033de066d7f769477f16/base/base_paths.cc
[modify] https://crrev.com/d5ae68ebcd7cc869074e033de066d7f769477f16/base/base_paths.h
[modify] https://crrev.com/d5ae68ebcd7cc869074e033de066d7f769477f16/base/base_paths_android.cc
[modify] https://crrev.com/d5ae68ebcd7cc869074e033de066d7f769477f16/base/base_paths_fuchsia.cc
[modify] https://crrev.com/d5ae68ebcd7cc869074e033de066d7f769477f16/base/base_paths_mac.mm
[modify] https://crrev.com/d5ae68ebcd7cc869074e033de066d7f769477f16/base/i18n/icu_util.cc
[modify] https://crrev.com/d5ae68ebcd7cc869074e033de066d7f769477f16/base/path_service_unittest.cc
[modify] https://crrev.com/d5ae68ebcd7cc869074e033de066d7f769477f16/base/test/test_support_android.cc
[modify] https://crrev.com/d5ae68ebcd7cc869074e033de066d7f769477f16/content/shell/app/shell_main_delegate.cc
[modify] https://crrev.com/d5ae68ebcd7cc869074e033de066d7f769477f16/gin/v8_initializer.cc

Components: Internals>PlatformIntegration
Project Member

Comment 3 by bugdroid1@chromium.org, Jun 18 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/dadea69ae5098c061fe2c64971b27fe0cb4d57f7

commit dadea69ae5098c061fe2c64971b27fe0cb4d57f7
Author: Sergey Ulanov <sergeyu@chromium.org>
Date: Mon Jun 18 20:43:44 2018

Chromecast: Use DIR_ASSETS instead of DIR_MODULE to locate resources.

DIR_MODULE should not be used to discover resource files on Fuchsia.
Replaced it with DIR_ASSETS. This fixes resource loading on Fuchsia,
but has no effect on other platforms.

Change-Id: Ia0d235a4d07dc2f3e6bcd905a401ede113998e8e
Bug: 805727
Reviewed-on: https://chromium-review.googlesource.com/1100377
Reviewed-by: Sergey Volk <servolk@chromium.org>
Commit-Queue: Sergey Ulanov <sergeyu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568147}
[modify] https://crrev.com/dadea69ae5098c061fe2c64971b27fe0cb4d57f7/chromecast/base/cast_paths.cc
[modify] https://crrev.com/dadea69ae5098c061fe2c64971b27fe0cb4d57f7/chromecast/common/cast_resource_delegate.cc

Sign in to add a comment