| Index: src/trusted/plugin/srpc/closure.cc | 
| =================================================================== | 
| --- src/trusted/plugin/srpc/closure.cc	(revision 1695) | 
| +++ src/trusted/plugin/srpc/closure.cc	(working copy) | 
| @@ -7,6 +7,7 @@ | 
|  | 
| #include <string.h> | 
| #include <string> | 
| +#include <list> | 
|  | 
| #include "native_client/src/shared/npruntime/npmodule.h" | 
| #include "native_client/src/shared/platform/nacl_host_desc.h" | 
| @@ -36,9 +37,13 @@ | 
| return (NPERR_NO_ERROR == err); | 
| } | 
|  | 
| -LoadNaClAppNotify::LoadNaClAppNotify(Plugin* plugin, std::string url) | 
| -    : Closure(plugin, url) { | 
| -  dprintf(("LoadNaClAppNotify ctor\n")); | 
| +LoadNaClAppNotify::LoadNaClAppNotify(Plugin* plugin, | 
| +                                     const std::list<std::string>& urls) | 
| +    : Closure(plugin, urls.front()), | 
| +      fallback_urls_(urls) { | 
| +  fallback_urls_.pop_front(); | 
| +  dprintf(("LoadNaClAppNotify ctor (trying URL %s + %d more)\n", | 
| +           url().c_str(), fallback_urls_.size())); | 
| } | 
|  | 
| LoadNaClAppNotify::~LoadNaClAppNotify() { | 
| @@ -50,7 +55,21 @@ | 
| static_cast<void*>(stream), | 
| fname)); | 
| if (NULL != fname) { | 
| +    assert(stream != NULL); | 
| plugin()->Load(stream->url, fname); | 
| +  } else { | 
| +    // Loading failed.  Try another URL if we have one. | 
| +    if (fallback_urls_.size() > 0) { | 
| +      LoadNaClAppNotify* callback = | 
| +          new(std::nothrow) LoadNaClAppNotify(plugin(), fallback_urls_); | 
| +      if ((NULL == callback) || (!callback->StartDownload())) { | 
| +        dprintf(("Failed to load URL to local file.\n")); | 
| +        // callback is always deleted in URLNotify | 
| +        // FIXME(adonovan): it is?  even when StartDownload failed? | 
| +        // FIXME(adonovan): shouldn't this result in the onfail handler | 
| +        // getting called? | 
| +      } | 
| +    } | 
| } | 
| } | 
|  | 
| @@ -63,7 +82,6 @@ | 
| } | 
| } | 
|  | 
| - | 
| UrlAsNaClDescNotify::UrlAsNaClDescNotify(Plugin* plugin, | 
| std::string url, | 
| void* callback_obj) : | 
|  |