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

Issue 7714036: [Mac] Return an empty StringPiece from GetDataResource() when g_resource_data_pack is NULL. (Closed)

Created:
9 years, 4 months ago by Alexei Svitkine (slow)
Modified:
9 years, 4 months ago
CC:
chromium-reviews, darin-cc_chromium.org, Nico
Visibility:
Public.

Description

[Mac] Return an empty StringPiece from GetDataResource() when |g_resource_data_pack| is NULL. When running unit tests, |g_resource_data_pack| is never loaded. As a result, if a resource is needed by code exercised by a test, the dereference of |g_resource_data_pack| would previously crash, unless that resource id was special cased. This CL changes it to instead return an empty StringPiece, rather than crashing. This allows PlatformBridge::loadPlatformImageResource() to return a Image::nullImage() in this case, which is fine for some resources loaded during unit tests. In particular, this fixes a crash in webkit_unit_tests that would otherwise happen with: https://bugs.webkit.org/show_bug.cgi?id=66707. BUG=93397 TEST=Run webkit_unit_tests with patch from https://bugs.webkit.org/show_bug.cgi?id=66707. They shouldn't crash. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=98101

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+2 lines, -1 line) Patch
M webkit/support/platform_support_mac.mm View 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 6 (0 generated)
Alexei Svitkine (slow)
9 years, 4 months ago (2011-08-24 15:01:00 UTC) #1
tony
LGTM. Would it be easier to just add the image to the switch statement? Either ...
9 years, 4 months ago (2011-08-24 16:51:13 UTC) #2
Alexei Svitkine (slow)
On Wed, Aug 24, 2011 at 12:51 PM, <tony@chromium.org> wrote: > Would it be easier ...
9 years, 4 months ago (2011-08-24 16:56:47 UTC) #3
tony
On 2011/08/24 16:56:47, Alexei Svitkine wrote: > On Wed, Aug 24, 2011 at 12:51 PM, ...
9 years, 4 months ago (2011-08-24 17:01:19 UTC) #4
Alexei Svitkine (slow)
Fair enough. Either way, I prefer the NULL check for other reasons too: - simpler ...
9 years, 4 months ago (2011-08-24 17:08:25 UTC) #5
commit-bot: I haz the power
9 years, 4 months ago (2011-08-24 20:13:13 UTC) #6
Change committed as 98101

Powered by Google App Engine
This is Rietveld 408576698