Split get_diff_files into get_diff_files and populate_diff_chunks.

get_diff_files was set up to run in two possible modes. In one mode, it
just fetched all the files and metadata that would be displayed in a
diff viewer. In the other mode, it would do that and load diff chunks.

Really, there was no reason to do both. It just made things more
complicated. The information loading mode was nothing but database hits,
so we had a certain known level of complexity there. The chunk loading
code, however, was very expensive, and drastically changed what you
would expect time-wise from the function.

Now the chunk loading is done in populate_diff_chunks, which just
iterates through the list of files provided by get_diff_files and loads
the chunks for each.

This is the first step in a series of changes I'm planning to make to
restructure bits of the diff handling code to make it more extensible.
Fix issues with spurious update bubbles and incorrect HTTP status codes.

The update bubbles on 1.7 have been broken for a while. Changing issue
statuses would cause an update bubble to appear, due to the timestamp
coming in not being in the correct format. We now set it exactly as the
Last Update resource sets it, by returning
last_activity_time.isoformat().

The Last Update resource was broken too. Every other check was returning
a 200 OK instead of a 304 Not Modified, when each one should be a 304
until there's actually new updates to report. This was due to the wrong
value being set in the Last Modified header, since we converted the
timestamp to ISO8601 format too soon. We now set the correct timestamp.
Fix extra Last Update check timers firing after changing issue statuses.

Every time we resolved or reopened an issue, we'd register again for
updates to the review request. However, we already had a check going, and
each new one caused a new check. This could mean we'd hammer the server
eventually.

We now have a RB.ReviewRequest.markUpdated function that sets the
last updated timestamp. We use this instead when resolving an issue. It
ensures that we don't interfere with the existing checks, but we do mark
that we know when the last activity was.
Optimize most pages, but especially the diff viewer and diff fragments.

This is another round of optimizations to reduce query counts on pages.

In general, most pages will now have at least 1 less query. Some will
have 2 or 3 fewer.

The default session backend caused one query per view that always looked
up the session in the database. This was one of the first queries
executed. However, Django has another backend, cached_db, that will
first attempt to look up the data in memcached, and if it doesn't find
it, it will fall back to the database and then populate that data in
memcached. It's much faster, and saves one query per page.

The @valid_prefs_required decorator looked up the user's profile using
get_or_create, meaning the profile never got cached for the user. This
resulted in an additional profile query later on in most cases. We now
use get_profile() optimistically, and fall back on logic to create it.
This affects many pages on the site.

The My Account page got similar optimizations to reduce query counts, as
did get_enable_highlighting (used in diff generation).

The big changes though are to the diff viewer/fragment code. In
view_diff_fragment, we had one query for the DiffSet, another for the
interdiff's DiffSet (if specified), another for the FileDiff, and
another resulting one later for the FileDiff's DiffSet (since it wasn't
cached). And that was just for the core diffviewer's view_diff_fragment.
The wrapper in reviews added another one for the DiffSet and one for the
interdiff's DiffSet.

This was cleaned up to only have two queries total. One to fetch both
DiffSets (or just one if not doing an interdiff) at once, and one to
fetch the FileDiff. We grab the correct objects out of the query and we
assign the diffset to the FileDiff so we don't look it up again later.
view_diff_fragment now also accepts IDs instead of objects, so the
reviews wrapper doesn't need to do a fetch and pass it off.

This is a savings of 3-5 queries per fragment.

The other savings is in _query_for_diff, which would call
review_request.diffset_history and get_draft(user). The former was
unnecessary, since all we needed was the ID, so we save a query by
referencing the ID and not grabbing the object itself.

The get_draft(user) was a bit redundant. Many of the call sites already
had a draft. Now it no longer makes its own call, and instead requires
that a draft be provided.

All told, we save quite a few queries now, and every page (and API call)
has at least 1 fewer query (assuming the session is in the cache).

Some highlights:

The diff viewer (minus subsequent fragments) went from 20 to 16 queries.

Individual diff fragments went from 14 to 8.

The My Account page went from 10 to 7.
Merge branch 'release-1.6.x'