Mobile Gmail should use 400 kB less memory
Mobile Gmail should use 400 kB less memory

According to my new telemetry-based benchmark, this CL reduces memory usage in
Mobile Gmail by 3 MB (at least as simulated by content_shell on Linux).
Specifically, the average of three runs dropped from 52.1 MB to 49.2 MB.

In looking at profiles of duplicated StringImpl objects from
https://src.chromium.org/viewvc/blink?revision=151336&view=revision, we noticed
that a large amount of duplicated StringImpl objects contained URLs
(particularly data URLs). This CL atomizes the underlying storage in KURL to
help us avoid storing duplicate URL strings.

Using STRING_STATS, the savings looks more like 400 kB of string data.  (The
total amount of string visible to STRING_STATS drops from 3305677 bytes to
2912873 bytes.)  A 400 kB savings sounds more realistic to me.  Here are the
before and after STRING_STATS:

== Before ==

String stats for process id 28425:
    6319 (99.15%) 8 bit             2692439 chars       2692439 bytes  avg length  426.1
      54 ( 0.85%) 16 bit             300731 chars        601462 bytes  avg length 5569.1
      28 ( 0.44%) upconverted          5888 chars         11776 bytes  avg length  210.3
    6373 Total                      2993170 chars       3305677 bytes  avg length  469.7
         Total savings      2686551 bytes (44.83%)
       5 copies (0 atomic) of length    23530 (potential savings:    94120) data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK...
      63 copies (0 atomic) of length      413 (potential savings:    25606) REPLACE INTO cached_conversation_headers (conversationId,isUnrea...
       3 copies (0 atomic) of length     9962 (potential savings:    19924) data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAA+CAYAAADgZd...
       3 copies (0 atomic) of length     9638 (potential savings:    19276) data:image/png;base64,R0lGODlhKAAoAPf/AB2pYP/STTuB+OBKPuFLPzh+9D...
       4 copies (0 atomic) of length     6230 (potential savings:    18690) data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAA+CAYAAADgZd...
       5 copies (0 atomic) of length     4418 (potential savings:    17672) data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAA+CAMAAADXuy...
       3 copies (0 atomic) of length     5518 (potential savings:    11036) data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAABYCAMAAACwAk...
       3 copies (0 atomic) of length     5146 (potential savings:    10292) data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAA+CAYAAADgZd...
       2 copies (0 atomic) of length     4890 (potential savings:     4890) data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAA+CAYAAADgZd...
       4 copies (0 atomic) of length     1598 (potential savings:     4794) data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADoAAAA6CAMAAADWZb...
       2 copies (0 atomic) of length     4438 (potential savings:     4438) data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFoAAABaCAYAAAA4qE...
       3 copies (0 atomic) of length     1954 (potential savings:     3908) data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/N...
       3 copies (0 atomic) of length     1854 (potential savings:     3708) data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADoAAAA6CAYAAADhu0...
       3 copies (0 atomic) of length     1834 (potential savings:     3668) data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADoAAAA6CAYAAADhu0...
       3 copies (0 atomic) of length     1806 (potential savings:     3612) data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADoAAAA6CAYAAADhu0...
       2 copies (0 atomic) of length     3542 (potential savings:     3542) data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFoAAABaCAYAAAA4qE...
       3 copies (0 atomic) of length     1770 (potential savings:     3540) data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAA9CAYAAABm8a...
       4 copies (0 atomic) of length     1134 (potential savings:     3402) data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFkAAAA8CAYAAAANMh...
       3 copies (0 atomic) of length     1662 (potential savings:     3324) data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH...
       3 copies (0 atomic) of length     1610 (potential savings:     3220) data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADoAAAA6CAYAAADhu0...

== After ==

String stats for process id 28148:
    5765 (99.23%) 8 bit             2390749 chars       2390749 bytes  avg length  414.7
      46 ( 0.79%) 16 bit             255622 chars        511244 bytes  avg length 5557.0
      26 ( 0.45%) upconverted          5440 chars         10880 bytes  avg length  209.2
    5810 Total                      2646371 chars       2912873 bytes  avg length  455.5
         Total savings      2385309 bytes (45.02%)
     161 copies (0 atomic) of length      413 (potential savings:    66080) REPLACE INTO cached_conversation_headers (conversationId,isUnrea...
     161 copies (0 atomic) of length       38 (potential savings:     6080) REPLACE INTO hit_to_data VALUES(?, ?);
      25 copies (0 atomic) of length      102 (potential savings:     2448) Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like ...
       9 copies (0 atomic) of length      101 (potential savings:      808) If you are unable to see this message, click here to viewTo ensu...
      38 copies (0 atomic) of length       20 (potential savings:      740) image/webp,*/*;q=0.8
     314 copies (0 atomic) of length        2 (potential savings:      626) []
      21 copies (0 atomic) of length       28 (potential savings:      560) response_code_set_by_backend
      35 copies (0 atomic) of length       14 (potential savings:      476) static-content
      49 copies (0 atomic) of length        9 (potential savings:      432) image/png
      15 copies (0 atomic) of length       24 (potential savings:      336) public, max-age=31536000
      35 copies (0 atomic) of length        9 (potential savings:      306) Yesterday
      16 copies (0 atomic) of length       19 (potential savings:      285) main:static-content
      22 copies (0 atomic) of length       13 (potential savings:      273) 1; mode=block
      11 copies (0 atomic) of length       24 (potential savings:      240) 2001:4860:4001:801::100f
       3 copies (0 atomic) of length      106 (potential savings:      212) XXXXXX REDACTED EMAIL TEXT XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...
       8 copies (0 atomic) of length       29 (potential savings:      203) Wed, 22 May 2013 01:15:48 GMT
       8 copies (0 atomic) of length       29 (potential savings:      203) Thu, 22 May 2014 01:15:48 GMT
       3 copies (0 atomic) of length      101 (potential savings:      202) XXXXXX REDACTED EMAIL TEXT XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...
       3 copies (0 atomic) of length      101 (potential savings:      202) XXXXXX REDACTED EMAIL TEXT XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...
       3 copies (0 atomic) of length      101 (potential savings:      202) XXXXXX REDACTED EMAIL TEXT XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

From these stats, it appears that this CL is saving memory by reducing copies of
data URLs.  Notice that many of the remaining copies are of HTTP header values
and SQL queries.  I'll tackle those in future CLs.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/15962016

git-svn-id: bf5cd6ccde378db821296732a091cfbcf5285fbd@151419 bbb929c8-8fbe-4397-9dbb-9b2b20218538

axinging/chromium-crosswalk,axinging/chromium-crosswalk,axinging/chromium-crosswalk,axinging/chromium-crosswalk,axinging/chromium-crosswalk,axinging/chromium-crosswalk,axinging/chromium-crosswalk,axinging/chromium-crosswalk,axinging/chromium-crosswalk,axinging/chromium-crosswalk,axinging/chromium-crosswalk